While 루프에서 첫 번째 루프를 벗어나지 만 While 루프에서 벗어나지 만 If If 체크에 들어 가지 않습니다. 뭐 잘못 했니?Java equals가 작동하지 않는다면 작동하지 않을 것입니다.
while (!"Y".equals(inputString) && !"N".equals(inputString)) {
inputString = Helper.InputHelper().toUpperCase();
if (inputString.equals("N")) {
System.out.println("Thank you for playing!");
System.exit(0);
} else if (inputString.equals("Y")) {
System.out.println("Starting a new game");
MineSweeper game;
game = new MineSweeper();
}
}
모두가 내가 뇌사,
System.out.println("Would you like to play another game? (Y/N): ");
String input = "";
while (!"Y".equals(input) && !"N".equals(input)) {
input = Helper.InputHelper().toUpperCase();
if (input.equals("N")) {
System.out.println("Thank you for playing!");
System.exit(0);
} else if (input.equals("Y")) {
System.out.println("Starting a new game");
MineSweeper game;
game = new MineSweeper();
}
}
로 변경하고있어 권리와 감사 완벽한 작동합니다.
죄송합니다. 실제로 그 질문은 어떤 것이 될까요? –
'!'는 연산자가 아니며, Y가 아닌 "N"을 사용합니다. – Ash
while (! a &&! b) {if (b)'... 여기에 문제가 있습니까? –