Java.lang Package Classes

Java.lang.Number Class



Java Number Class

Java.lang package provides a Number class which is a abstract class and it is the superclass of platform classes representing numeric values that are convertible to the primitive types byte, double, float, int, long, and short.

Class declaration

The declaration of java.lang.Number class is:

public abstract class Number
  extends Object
    implements Serializable

Class Constructor

S.NConstructors & Description
1. Number()

java.lang.Number Methods

The java.lang.Number class has a number of methods which are listed below:

Member Methods

S.NMethods & 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

This class inherits the methods of following class:

  • java.lang.Object