In my While loop after the first loop it does break out of the While loop but it does not step into my If check, does anyone see what I've done wrong?
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();
}
}
Everyone is right I'm braindead, changed it to
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();
}
}
and works flawless thank you.