The abstract class Number
has subclasses Integer
, Long
, Float
, and Double
which wrap primitive types, defining abstract methods to convert the represented
numeric value to int
, long
, float
, and double
.
public abstract classNumber
{ public abstract intintValue
(); public abstract longlongValue
(); public abstract floatfloatValue
(); public abstract doubledoubleValue
(); }
20.6.1 public abstract int intValue()
The general contract of the intValue
method is that it returns the numeric value
represented by this Number
object after converting it to type int
.
Overridden by Integer
(§20.7.8), Long
(§20.8.8), Float
(§20.9.12), and Double
(§20.10.11).
20.6.2 public abstract long longValue()
The general contract of the longValue
method is that it returns the numeric value
represented by this Number
object after converting it to type long
.
Overridden by Integer
(§20.7.9), Long
(§20.8.9), Float
(§20.9.13), and Double
(§20.10.12).
20.6.3 public abstract float floatValue()
The general contract of the floatValue
method is that it returns the numeric
value represented by this Number
object after converting it to type float
.
Overridden by Integer
(§20.7.10), Long
(§20.8.10), Float
(§20.9.14), and Double
(§20.10.13).
20.6.4 public abstract double doubleValue()
The general contract of the doubleValue
method is that it returns the numeric
value represented by this Number
object after converting it to type double
.
Overridden by Integer
(§20.7.11), Long
(§20.8.11), Float
(§20.9.15), and Double
(§20.10.14).