Is it possible to extend the Math class and still use the Math class to call the extended method?
For example, I have a method public static double mean (LinkedList<? extends Number) I would like to call like this Math.mean(list). Is this doable? How?
Thanks.
Doc Java.lang.Math is Final class, can't be extended
Update:
Static Method can't be inherited & final class can't be extended.
Even if Math wasn't final, you couldn't do this. You can't use a superclass to call a function defined in a subclass. By definition, a subclass has access to all non-private methods defined in the superclass, but a superclass does not have access to functions in a subclass.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With