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
  • 151,199
  • 17
  • 111
  • 216
WildanVEP
  • 71
  • 11

0 Answers0