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;
}
大咪
相关分类