想排除字符的输入,应该怎么去操作----------------->大家请进
public void showShop(){
System.out.println("欢迎使用我行我素购物系统1.0版");
System.out.println("***************************************");
System.out.print("\n\t\t1.登录系统");
System.out.println("\n\n\t\t2.退出\n");
System.out.println("***************************************");
Scanner input = new Scanner(System.in);
System.out.println("请选择,输入数字: ");
int login = input.nextInt();
switch (login)
{
case 1:
mainmenu();
break;
case 2:
System.out.println("拜拜,下次见!!!");
break;
default:
System.out.println("输入错误,请检查!!!");
showShop();
}
}