Home > other >  input.next() keeps waiting for an input
input.next() keeps waiting for an input

Time:04-30

Note: My code is written in Java.

I am making a reaction time test which works completely well otherwise. However, when I press enter it continues to wait for an input, which makes the reaction time test less effective. What should I write so that the Enter Key can be taken as an input rather than having to type a character then press enter.

CodePudding user response:

You could use input.nextLine();

CodePudding user response:

You can write input.nextLine() which returns whole input except for the line separator, as it finds line separator it skips the input.

  •  Tags:  
  • java
  • Related