老师,在catch语句中为什么又创建一个console = new Scanner(System.in);?
private static int inputCommand(){
int command;
try {
command = console.nextInt();
return command;
} catch (Exception e) {
console = new Scanner(System.in);
return -1;
}
}
老师,在catch语句中为什么又创建一个console = new Scanner(System.in);?