public class InputData { private BufferedReader buf=null; public InputData() { this.buf=new BufferedReader(new InputStreamReader(System.in)); } public int getInt(String info,String err){ int i=0; boolean flag=true; while(flag){ String str=this.getString(info); if(str.matches("\\d+")){ i=Integer.parseInt(str); flag=false; }else{ System.out.println(err); } } return i; }
添加回答
举报
0/150
提交
取消