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”

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

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

Google photo

You are commenting using your Google 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