CHAPTER 20: The Package java.lang Previous
Previous
Java Language
Java Language
Index
Index
Next
Next

20.6 The Class java.lang.Number

20.6.1 intValue , 20.6.2 longValue , 20.6.3 floatValue , 20.6.4 doubleValue

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 class Number {
	public abstract int intValue();
	public abstract long longValue();
	public abstract float floatValue();
	public abstract double doubleValue();
}


20.6.1 intValue

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 (S20.7.8), Long (S20.8.8), Float (S20.9.12), and Double (S20.10.11).


20.6.2 longValue

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 (S20.7.9), Long (S20.8.9), Float (S20.9.13), and Double (S20.10.12).


20.6.3 floatValue

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 (S20.7.10), Long (S20.8.10), Float (S20.9.14), and Double (S20.10.13).


20.6.4 doubleValue

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 (S20.7.11), Long (S20.8.11), Float (S20.9.15), and Double (S20.10.14).

Top© 1996 Sun Microsystems, Inc. All rights reserved.