Boolean play = true; while (play) { // game code here System.out.println("Would you like to play again Y/N?"); play = in.nextLine().trim().equalsIgnoreCase("y"); // "y" will set 'play' to 'true', anything else will set it to 'false' }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)