Class java.lang.Number
All Packages Class Hierarchy This Package Previous Next Index
Class java.lang.Number
Object
|
+----java.lang.Number
- public abstract class Number
- extends Object
- implements Serializable
The abstract class Number
is the superclass of
classes Byte
, Double
, Float
,
Integer
, Long
, and Short
.
Subclasses of Number
must provide methods to convert
the represented numeric value to byte
, double
,
float
, int
, long
, and
short
.
- Version:
- 1.21, 07/01/98
- Author:
- Lee Boynton, Arthur van Hoff
- Since:
- JDK1.0
- See Also:
- Byte, Double, Float, Integer, Long, Short
-
java.lang.Number()
-
-
byteValue()
- Returns the value of the specified number as a
byte
.
-
doubleValue()
- Returns the value of the specified number as a
double
.
-
floatValue()
- Returns the value of the specified number as a
float
.
-
intValue()
- Returns the value of the specified number as an
int
.
-
longValue()
- Returns the value of the specified number as a
long
.
-
shortValue()
- Returns the value of the specified number as a
short
.
Number
public Number()
byteValue
public byte byteValue()
- Returns the value of the specified number as a
byte
.
This may involve rounding or truncation.
- Returns:
- the numeric value represented by this object after conversion
to type
byte
.
- Since:
- JDK1.1
doubleValue
public abstract double doubleValue()
- Returns the value of the specified number as a
double
.
This may involve rounding.
- Returns:
- the numeric value represented by this object after conversion
to type
double
.
- Since:
- JDK1.0
floatValue
public abstract float floatValue()
- Returns the value of the specified number as a
float
.
This may involve rounding.
- Returns:
- the numeric value represented by this object after conversion
to type
float
.
- Since:
- JDK1.0
intValue
public abstract int intValue()
- Returns the value of the specified number as an
int
.
This may involve rounding.
- Returns:
- the numeric value represented by this object after conversion
to type
int
.
- Since:
- JDK1.0
longValue
public abstract long longValue()
- Returns the value of the specified number as a
long
.
This may involve rounding.
- Returns:
- the numeric value represented by this object after conversion
to type
long
.
- Since:
- JDK1.0
shortValue
public short shortValue()
- Returns the value of the specified number as a
short
.
This may involve rounding or truncation.
- Returns:
- the numeric value represented by this object after conversion
to type
short
.
- Since:
- JDK1.1
All Packages Class Hierarchy This Package Previous Next Index