-1
我想把一个扫描仪内的案件。这是发生了什么:开关柜式扫描仪Java问题
[中]计算
[中] 5
[出]对不起,我不明白 '[空格]'。再试一次。
while (running) {
stringInput = in.nextLine();
switch (stringInput) {
case "help":
System.out.println("[NYI]");
break;
case "calc":
longInput = in.nextLong();
if (longInput > Long.MAX_VALUE) {
System.err.print("Sorry, that is too big, try again.");
break;
} else if (Math.signum(longInput) < 1) {
System.err.println("Sorry, that number is negative/zero , try again.");
continue;
} else {
sleep(longInput);
calc += cps * (longInput/1000);
break;
}
default:
System.err.println("Sorry, I don't understand '" + stringInput + "'. Try again.");
}
}
我不知道为什么会发生这种情况。请帮忙!
switch中的continue关键字的用途是什么? – Theo
输入是什么? – gidim