站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JDK 5 Documentation v1.2.2, Java 2 SDK 英文文档

Java(TM) 2 Platform, Standard Edition, v1.2.2 API Specification: Class Number - JDK 5 Documentation v1.2.2, Java 2 SDK 英文文档

JavaTM 2 Platform
Standard Edition

java.lang
Class Number

java.lang.Object
  |
  +--java.lang.Number
Direct Known Subclasses:
BigDecimal, BigInteger, Byte, Double, Float, Integer, Long, Short

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.

Since:
JDK1.0
See Also:
Byte, Double, Float, Integer, Long, Short, Serialized Form

Constructor Summary
Number()
           
 
Method Summary
 byte byteValue()
          Returns the value of the specified number as a byte.
abstract  double doubleValue()
          Returns the value of the specified number as a double.
abstract  float floatValue()
          Returns the value of the specified number as a float.
abstract  int intValue()
          Returns the value of the specified number as an int.
abstract  long longValue()
          Returns the value of the specified number as a long.
 short shortValue()
          Returns the value of the specified number as a short.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Number

public Number()
Method Detail

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.

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.

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.

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.

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

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

JavaTM 2 Platform
Standard Edition

Submit a bug or feature
Java, Java 2D, and JDBC are a trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1999 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.