Java Console Prompt for ENTER input before moving on [duplicate]

The reason why is not blocking the second time is that when the user presses ENTER the first time, two bytes will be stored corresponding to \r and \n.

Instead use a Scanner instance:

public void promptEnterKey(){
   System.out.println("Press \"ENTER\" to continue...");
   Scanner scanner = new Scanner(;

Leave a Comment