Javatpoint Logo
Javatpoint Logo

Java Number Class

Java Number class is an abstract class which is placed in java.lang package. It has four abstract methods and two concrete methods. The abstract class Number is the superclass of classes BigDecimal, BigInteger, Byte, Double, Float, Integer, Long, and Short. This class contains a single consructor number().

Number Class Methods

Java Number class provides methods to convert the represented numeric value to byte, double, float, int, long, and short type. The various Java Number methods are as follows-

SN Modifier & Type Method Description
1) Byte byteValue() It converts the given number into a byte type and returns the value of the specified number as a byte.
2) abstract double doubleValue() It returns the value of the specified number as a double equivalent.
3) abstract float floatValue() It returns the float equivalent value of the specified Number object.
4) abstract int intValue() It returns the value of the specified number as an int.
5) abstract long longValue() It returns the value of the specified number object as long equivalent.
6) short shortValue() It returns the value of the specified number as a short type after a primitive conversion.

Next TopicJava Number Class





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA