我想捕获 InputMissmatchException 但不停止重新执行代码(我希望 while 循环再次重新运行,直到给出适当的输入)
整数选择 = 0;布尔循环=真;
while(loop){
printInstruction();
choice = scanner.nextInt();
//catch InputMissmatchException
switch(choice){
case 0:
loop = false;
break;
case 1:
addCustomer(mohamad,sgbl);
break;
case 2:
deleteCustomer(sgbl);
break;
case 3:
seeInfo(sgbl);
break;
case 4:
makeTransaction(mohamad);
break;
case 5:
seeTransactionLog(mohamad);
break;
default:
System.out.println("try again");
}
}
郎朗坤
相关分类