I have read source code of java.lang.Number
and I wondered why
intValue()
longValue()
floatVa
According to the documentation of the Number class, the methods byteValue
and shortValue
were added first in JDK1.1. This is unlike the other "Value" methods which were already available in the very first JDK release.
My assumption is that those two methods were made concrete in order to keep compatibility with existing (also non-standard) subclasses of Number
, which would otherwise have been broken by the addition of new abstract methods in the superclass.