parseInt
public static int parseInt(String s)
                    throws NumberFormatException
Parses the string argument as a signed decimal integer. The characters in the string must all be decimal digits, except that the first character may be an ASCII minus sign '-' ('\u002D') to indicate a negative value. The resulting integer value is returned, exactly as if the argument and the radix 10 were given as arguments to the parseInt(java.lang.String, int) method. Parameters:
s - a String containing the int representation to be parsed 
Returns:
the integer value represented by the argument in decimal. 
Throws: 
NumberFormatException - if the string does not contain a parsable integer.parseFloat
public static float parseFloat(String s)
                        throws NumberFormatException
Returns a new float initialized to the value represented by the specified String, as performed by the valueOf method of class Float. Parameters:
s - the string to be parsed. 
Returns:
the float value represented by the string argument. 
Throws: 
NumberFormatException - if the string does not contain a parsable float.
Since: 
1.2 
See Also:
valueOf(String)parseDouble
public static double parseDouble(String s)
                          throws NumberFormatException
Returns a new double initialized to the value represented by the specified String, as performed by the valueOf method of class Double. Parameters:
s - the string to be parsed. 
Returns:
the double value represented by the string argument. 
Throws: 
NumberFormatException - if the string does not contain a parsable double.
Since: 
1.2 
See Also:
valueOf(String)parseLong
public static long parseLong(String s)
                      throws NumberFormatException
Parses the string argument as a signed decimal long. The characters in the string must all be decimal digits, except that the first character may be an ASCII minus sign '-' (\u002D') to indicate a negative value. The resulting long value is returned, exactly as if the argument and the radix 10 were given as arguments to the parseLong(java.lang.String, int) method. 
Note that neither the character L ('\u004C') nor l ('\u006C') is permitted to appear at the end of the string as a type indicator, as would be permitted in Java programming language source code. 
Parameters:
s - a String containing the long representation to be parsed 
Returns:
the long represented by the argument in decimal. 
Throws: 
NumberFormatException - if the string does not contain a parsable long.

解决方案 »

  1.   

    parseNumbers
    public void parseNumbers()
    Specifies that numbers should be parsed by this tokenizer. The syntax table of this tokenizer is modified so that each of the twelve characters: 
          0 1 2 3 4 5 6 7 8 9 . -
     
    has the "numeric" attribute. When the parser encounters a word token that has the format of a double precision floating-point number, it treats the token as a number rather than a word, by setting the the ttype field to the value TT_NUMBER and putting the numeric value of the token into the nval field. 
    See Also:
    nval, TT_NUMBER, ttype
      

  2.   

    valueOf()返回的是哪种类型?Float?Double?
      

  3.   

    多看一下帮助文件吧,大概是parseInt,parseDouble
      

  4.   

    jdk的帮助文件很有用,不过在我的电脑里是乱码〉我用JBuilder里的帮助,一回事!