new Integer( "123" ).intValue()

解决方案 »

  1.   

    String s = "123";
    int i = Integer.parseInt(s);
      

  2.   

    如果 S = “123abc”;
    他会抛异常的,怎么办呀?  ^&^
      

  3.   

    对呀,还有"jh12388" , "GG123" , "MM123" , "123GGMM" ... ^_^
      

  4.   

    try{
        i = Integer.parseInt(ss);
      }catch(Exception e){
        e.printStackTrace(); 或者在此通过程序将那些字母去掉然后
        i = Integer.parseInt(ss);  }