Java.lang.Number Class

Java.lang.Number Class

Introduction

The java.lang.Number class is the superclass of classes BigDecimal, BigInteger, Byte, Double, Float, Integer, Long, and Short.The Subclasses of Number must provide methods to convert the represented numeric value to byte, double, float, int, long, and short.

Class declaration

Following is the declaration for java.lang.Number class:

public abstract class Number
   extends Object
      implements Serializable

Class constructors

S.N.Constructor & Description
1Number()

This is the Single Constructor.

Class methods

S.N.Method & Description
1byte byteValue()

This method returns the value of the specified number as a byte.

2abstract double doubleValue()

This method returns the value of the specified number as a double.

3abstract float floatValue()

This method returns the value of the specified number as a float.

4abstract int intValue()

This method returns the value of the specified number as a int.

5abstract long longValue()

This method returns the value of the specified number as a long.

6short shortValue()

This method returns the value of the specified number as a short.

Methods inherited

This class inherits methods from the following classes:

  • java.lang.Object

Was this article helpful?

Related Articles

Leave A Comment?

You must be logged in to post a comment.