<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.4.2-rc) on Fri Jun 13 00:14:19 PDT 2003 -->
<TITLE>
Number (Java 2 Platform SE v1.4.2)
</TITLE>
<META NAME="keywords" CONTENT="java.lang.Number class">
<META NAME="keywords" CONTENT="intValue()">
<META NAME="keywords" CONTENT="longValue()">
<META NAME="keywords" CONTENT="floatValue()">
<META NAME="keywords" CONTENT="doubleValue()">
<META NAME="keywords" CONTENT="byteValue()">
<META NAME="keywords" CONTENT="shortValue()">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="Number (Java 2 Platform SE v1.4.2)";
}
</SCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Number.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
<b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Std. Ed. v1.4.2</b></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../java/lang/Math.html" title="class in java.lang"><B>PREV CLASS</B></A>
<A HREF="../../java/lang/Object.html" title="class in java.lang"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../index.html" target="_top"><B>FRAMES</B></A>
<A HREF="Number.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
java.lang</FONT>
<BR>
Class Number</H2>
<PRE>
<A HREF="../../java/lang/Object.html" title="class in java.lang">java.lang.Object</A>
<IMG SRC="../../resources/inherit.gif" ALT="extended by"><B>java.lang.Number</B>
</PRE>
<DL>
<DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../java/io/Serializable.html" title="interface in java.io">Serializable</A></DD>
</DL>
<DL>
<DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../java/math/BigDecimal.html" title="class in java.math">BigDecimal</A>, <A HREF="../../java/math/BigInteger.html" title="class in java.math">BigInteger</A>, <A HREF="../../java/lang/Byte.html" title="class in java.lang">Byte</A>, <A HREF="../../java/lang/Double.html" title="class in java.lang">Double</A>, <A HREF="../../java/lang/Float.html" title="class in java.lang">Float</A>, <A HREF="../../java/lang/Integer.html" title="class in java.lang">Integer</A>, <A HREF="../../java/lang/Long.html" title="class in java.lang">Long</A>, <A HREF="../../java/lang/Short.html" title="class in java.lang">Short</A></DD>
</DL>
<HR>
<DL>
<DT>public abstract class <B>Number</B><DT>extends <A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A><DT>implements <A HREF="../../java/io/Serializable.html" title="interface in java.io">Serializable</A></DL>
<P>
The abstract class <code>Number</code> is the superclass of classes
<code>BigDecimal</code>, <code>BigInteger</code>,
<code>Byte</code>, <code>Double</code>, <code>Float</code>,
<code>Integer</code>, <code>Long</code>, and <code>Short</code>.
该Number抽象类是BigDecimal、BigInteger、Byte、Double、Float、Integer、Long、Short类的父类。
<p>
Subclasses of <code>Number</code> must provide methods to convert
the represented numeric value to <code>byte</code>, <code>double</code>,
<code>float</code>, <code>int</code>, <code>long</code>, and
<code>short</code>.
Number的子类必须提供把代表的数值转化成byte、double、float、int、long、short类型的方法。
<P>
<P>
<DL>
<DT><B>Since:</B></DT>
<DD>JDK1.0</DD>
<DT><B>See Also:</B><DD><A HREF="../../java/lang/Byte.html" title="class in java.lang"><CODE>Byte</CODE></A>,
<A HREF="../../java/lang/Double.html" title="class in java.lang"><CODE>Double</CODE></A>,
<A HREF="../../java/lang/Float.html" title="class in java.lang"><CODE>Float</CODE></A>,
<A HREF="../../java/lang/Integer.html" title="class in java.lang"><CODE>Integer</CODE></A>,
<A HREF="../../java/lang/Long.html" title="class in java.lang"><CODE>Long</CODE></A>,
<A HREF="../../java/lang/Short.html" title="class in java.lang"><CODE>Short</CODE></A>,
<A HREF="../../serialized-form.html#java.lang.Number">Serialized Form</A></DL>
<HR>
<P>
<!-- ======== NESTED CLASS SUMMARY ======== -->
<!-- =========== FIELD SUMMARY =========== -->
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../java/lang/Number.html#Number()">Number</A></B>()</CODE>
<BR>
</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Method Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> byte</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/lang/Number.html#byteValue()">byteValue</A></B>()</CODE>
<BR>
Returns the value of the specified number as a <code>byte</code>.将指定numer值以byte形式返回。</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>abstract double</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/lang/Number.html#doubleValue()">doubleValue</A></B>()</CODE>
<BR>
Returns the value of the specified number as a <code>double</code>.将指定numer值以double形式返回。</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>abstract float</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/lang/Number.html#floatValue()">floatValue</A></B>()</CODE>
<BR>
Returns the value of the specified number as a <code>float</code>.将指定numer值以float形式返回。</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>abstract int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/lang/Number.html#intValue()">intValue</A></B>()</CODE>
<BR>
Returns the value of the specified number as an <code>int</code>.将指定numer值以int形式返回。</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>abstract long</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/lang/Number.html#longValue()">longValue</A></B>()</CODE>
<BR>
Returns the value of the specified number as a <code>long</code>.将指定numer值以long形式返回。</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> short</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../java/lang/Number.html#shortValue()">shortValue</A></B>()</CODE>
<BR>
Returns the value of the specified number as a <code>short</code>.将指定numer值以short形式返回。</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from class java.lang.<A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../java/lang/Object.html#clone()">clone</A>, <A HREF="../../java/lang/Object.html#equals(java.lang.Object)">equals</A>, <A HREF="../../java/lang/Object.html#finalize()">finalize</A>, <A HREF="../../java/lang/Object.html#getClass()">getClass</A>, <A HREF="../../java/lang/Object.html#hashCode()">hashCode</A>, <A HREF="../../java/lang/Object.html#notify()">notify</A>, <A HREF="../../java/lang/Object.html#notifyAll()">notifyAll</A>, <A HREF="../../java/lang/Object.html#toString()">toString</A>, <A HREF="../../java/lang/Object.html#wait()">wait</A>, <A HREF="../../java/lang/Object.html#wait(long)">wait</A>, <A HREF="../../java/lang/Object.html#wait(long, int)">wait</A></CODE></TD>
</TR>
</TABLE>
<P>
<!-- ============ FIELD DETAIL =========== -->
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="Number()"><!-- --></A><H3>
Number</H3>
<PRE>
public <B>Number</B>()</PRE>
<DL>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="intValue()"><!-- --></A><H3>
intValue</H3>
<PRE>
public abstract int <B>intValue</B>()</PRE>
<DL>
<DD>Returns the value of the specified number as an <code>int</code>.
This may involve rounding or truncation.将指定numer值以int形式返回,可能涉及舍入或取整。
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>the numeric value represented by this object after conversion
to type <code>int</code>.该对象转化成int类型后表示的数值。</DL>
</DD>
</DL>
<HR>
<A NAME="longValue()"><!-- --></A><H3>
longValue</H3>
<PRE>
public abstract long <B>longValue</B>()</PRE>
<DL>
<DD>Returns the value of the specified number as a <code>long</code>.
This may involve rounding or truncation.将指定numer值以long形式返回,可能涉及舍入或取整。
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>the numeric value represented by this object after conversion
to type <code>long</code>.该对象转化成long类型后表示的数值。</DL>
</DD>
</DL>
<HR>
<A NAME="floatValue()"><!-- --></A><H3>
floatValue</H3>
<PRE>
public abstract float <B>floatValue</B>()</PRE>
<DL>
<DD>Returns the value of the specified number as a <code>float</code>.
This may involve rounding.将指定numer值以float形式返回,可能涉及舍入。
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>the numeric value represented by this object after conversion
to type <code>float</code>.该对象转化成float类型后表示的数值。</DL>
</DD>
</DL>
<HR>
<A NAME="doubleValue()"><!-- --></A><H3>
doubleValue</H3>
<PRE>
public abstract double <B>doubleValue</B>()</PRE>
<DL>
<DD>Returns the value of the specified number as a <code>double</code>.
This may involve rounding.将指定numer值以double形式返回,可能涉及舍入。
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>the numeric value represented by this object after conversion
to type <code>double</code>.该对象转化成double类型后表示的数值。</DL>
</DD>
</DL>
<HR>
<A NAME="byteValue()"><!-- --></A><H3>
byteValue</H3>
<PRE>
public byte <B>byteValue</B>()</PRE>
<DL>
<DD>Returns the value of the specified number as a <code>byte</code>.
This may involve rounding or truncation.将指定numer值以byte形式返回,可能涉及舍入或取整。
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>the numeric value represented by this object after conversion
to type <code>byte</code>.该对象转化成byte类型后表示的数值。<DT><B>Since:</B></DT>
<DD>JDK1.1</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="shortValue()"><!-- --></A><H3>
shortValue</H3>
<PRE>
public short <B>shortValue</B>()</PRE>
<DL>
<DD>Returns the value of the specified number as a <code>short</code>.
This may involve rounding or truncation.将指定numer值以short形式返回,可能涉及舍入或取整。
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>the numeric value represented by this object after conversion
to type <code>short</code>.该对象转化成short类型后表示的数值。<DT><B>Since:</B></DT>
<DD>JDK1.1</DD>
</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Number.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
<b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Std. Ed. v1.4.2</b></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../java/lang/Math.html" title="class in java.lang"><B>PREV CLASS</B></A>
<A HREF="../../java/lang/Object.html" title="class in java.lang"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../index.html" target="_top"><B>FRAMES</B></A>
<A HREF="Number.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
<font size="-1"><a href="http://java.sun.com/cgi-bin/bugreport.cgi">Submit a bug or feature</a><br>For further API reference and developer documentation, see <a href="../../../relnotes/devdocs-vs-specs.html">Java 2 SDK SE Developer Documentation</a>. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. <p>Copyright 2003 Sun Microsystems, Inc. All rights reserved. Use is subject to <a href="../../../relnotes/license.html">license terms</a>. Also see the <a href="http://java.sun.com/docs/redist.html">documentation redistribution policy</a>.</font>
</BODY>
</HTML>
本文地址:http://com.8s8s.com/it/it10872.htm