NumberNameNumberSynopsis
DescriptionThe Number class is an abstract class that serves as the superclass for all of the classes that provide object wrappers for primitive numeric values: byte, short, int, long, float, and double. Wrapping a primitive value is useful when you need to treat such a value as an object. For example, there are a number of utility methods that take a reference to an Object as one of their arguments. You cannot specify a primitive value for one of these arguments, but you can provide a reference to an object that encapsulates the primitive value. Furthermore, as of JDK 1.1, these wrapper classes are necessary to support the Reflection API and class literals. The Number class defines six methods that must be implemented by its subclasses: byteValue(), shortValue(), intValue(), longValue(), floatValue(), and doubleValue(). This means that a Number object can be fetched as an byte, short, int, long, float, or double value, without regard for its actual class. Class Summary
public abstract class java.lang.Number extends java.lang.Number implements java.io.Serializable { // Instance Methods public abstract byte byteValue(); // New in 1.1 public abstract double doubleValue(); public abstract float floatValue(); public abstract int intValue(); public abstract long longValue(); public abstract short shortValue(); // New in 1.1 } Instance MethodsbyteValuepublic abstract byte byteValue()
doubleValuepublic abstract double doubleValue()
floatValuepublic abstract float floatValue()
intValuepublic abstract int intValue()
longValuepublic abstract long longValue()
shortValuepublic abstract short shortValue()
Inherited Methods
See AlsoByte, Double, Float, Integer, Long, Object, Short |
|