Java.lang.Number Class
Java Number Class
The Number class,i .e Java.lang.Number which is an abstract class and the superclass of platform classes expressing numeric values that are convertible to the primitive types byte, double, float, int, long, and short, is provided by Java.lang package.
Class declaration
The declaration of java.lang.Number class is:
public abstract class Number extends Object implements Serializable
Class Constructor
S.N | Constructors & Description |
---|---|
1. | Number() |
Java.lang.Number Methods
The java.lang.Number class has a number of methods which are listed below:
Member Methods
S.N | Methods & Description |
---|---|
1. | byte byteValue() Returns the value of the specified number as a byte, which may involve rounding or truncation. |
2. | abstract double doubleValue() Returns the value of the specified number as a double, which may involve rounding. |
3. | abstract float floatValue() Returns the value of the specified number as a float, which may involve rounding. |
4. | abstract int intValue() Returns the value of the specified number as an int, which may involve rounding or truncation. |
5. | abstract long longValue() Returns the value of the specified number as a long, which may involve rounding or truncation. |
6. | short shortValue() Returns the value of the specified number as a short, which may involve rounding or truncation. |
Methods inherited by Java.lang.Number
This class inherits the methods of the following class:
- java.lang.Object
To open the online compiler click here.