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”

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s