你自己把字符串,转化成数字不就得了。
Integer.parseInt(str);

解决方案 »

  1.   

    BufferedReader b=new BufferedReader(new InputStreamReader(System.in));
    try(){
       String s=b.readLine();
       int i=Integer.parseInt(b);
    }
    catch(IOException e){
        System.out.println("输入的不是整数或IO设备异常");
    }
    给分!!
      

  2.   

    import java.io.*;public class tmp{
    public static void main(String[] args) throws Exception{
    String str=new BufferedReader(new InputStreamReader(System.in)).readLine();
    System.out.println(Integer.parseInt(str));
    }
    }