为什么在catch里加上input = new Scanner(System.in);能够阻止无限循环
public static int inputCommand()
{
int a;
try
{
a = input.nextInt();
return a;
}catch(Exception e)
{
input = new Scanner(System.in);//阻止无限循环
//System.out.println("命令输入错误!请根据提示输入数字命令!");
return -1;
}
}