Question
Suppose you want to write a class that offers static methods to compute hyperbolic trigonometric functions.
You decide to subclass java.lang.Math and provide the new functionality as a set of static methods.
Which one statement is true about this strategy?
- A. The strategy works.
- B. The strategy works, provided the new methods are public.
- C. The strategy works, provided the new methods are not private.
- D. The strategy fails because you cannot subclass java.lang.Math.
- E. The strategy fails because you cannot add static methods to a subclass.
D.
Note
The java.lang.Math class is final, so it cannot be subclassed.
PreviousNextRelated