Java using scanner enter key pressed
问题 I am programming using Java. I am trying write code which can recognize if the user presses the enter key in a console based program. How can I do this using java. I have been told that this can be done using either Scanner or, buffered input reader. I do not understand(or know how to use) buffered input reader. I tried to do do this using scanner but after pressing enter twice the program terminates, and it doesn\'t work Scanner readinput = new Scanner(System.in); String enterkey = \"Hola\";