0

So, I already have this code for looping while press Enter

boolean inputCheck = true;

inputCheck = true;
while(inputCheck ){
    System.out.println(For example this is main menu);
    System.out.println("Press Enter to back to Main Menu");

    balikMenu = scan.nextLine();
    if(balikMenu.isEmpty()) {
        inputCheck = true;
    }
}

My question is, is there any other method besides using the scan? I don't want to use any key other than the enter key and don't accept any input other than enter to get the boolean true.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
WildanVEP
  • 71
  • 2
  • 14

0 Answers0