Implementing "press any key to continue" in Java

Implementing "press any key to continue" in Java

Well, strictly speaking, it is "press ENTER to continue".

Try

System.in.read(new byte[2]);

Under Windows, an ENTER gives \r\n. So 2 bytes are needed here.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.

More information about formatting options

To prevent automated spam submissions leave this field empty.