java.lang.Number Class & Methods

The abstract class java.lang.Number is the superclass of classes BigDecimal, BigInteger, Byte, Double, Float, Integer, Long, and Short. These must provide methods to convert the represented numeric value to byte, double, float, int, long, and short and additional methods as utility.

Constructors:

  • Number()

Methods :

  • byte byteValue(): Returns the value of the specified number as a byte.
  • abstract double doubleValue(): Returns the value of the specified number as a double.
  • abstract float floatValue(): Returns the value of the specified number as a float.
  • abstract int intValue(): Returns the value of the specified number as an int.
  • abstract long longValue(): Returns the value of the specified number as a long.
  • short shortValue(): Returns the value of the specified number as a short.

Exception :

[Solved] java.lang.NumberFormatException: For input string “AB.C”