Scanner scan = new Scanner(System.in);
while(true){
System.out.println("请输入:");
String line = scan.nextLine();
int num = 0;
try{
num = Integer.parseInt(line);
}catch(NumberFormatException e){
System.out.print("输入错误, ");
continue;
}
System.out.println(num);
scan.close();
break;
}
那要看是怎样的代码的啊。。。。。。。。。。。