String str="55";
int i = Integer.parseInt(str);

解决方案 »

  1.   

    int aa = Integer.parseInt(str);在java.lang.*;中
      

  2.   

    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.
      

  3.   

    int iA = Integer.parseInt(String sA);
      

  4.   

    String str="55";
    int i = Integer.parseInt(str);
      

  5.   

    建议楼主在下次定义的 时候最好不要用String str ="55",比较危险,String aa="55" 多好呀!!!!