Thanks Hal. I should have been more clear in my post -- I'm pretty
experienced & know how to use BufferedReader. Its a teaching situation, so I
don't want to burden students with throws quite yet. The new Scanner class
in 5.0 is a great feature since it simplifies console apps in a standardized
way and swallows the IOException.
I was hoping maybe someone knew how to coax it into reading empty tokens, eg
the Enter key with no data input. Anyone know if its possible?
--D
"Hal Rosser" <hm******@bellsouth.net> wrote in message
news:dv********************@bignews4.bellsouth.net ...
"Doug Lowe" <Do*******@spam-LoweWriter.com> wrote in message
news:4%iud.547511$D%.281264@attbi_s51... In Java 1.5, what's the easiest way to get a console java app to stop
until the user presses the Enter key?
I want to do something like this:
Scanner sc = new Scanner(System.in);
String answer;
...
System.out.print("Press Enter to continue...");
answer = sc.next();
But unfortunately the Scanner class makes you actually enter something,
it doesn't accept an empty string.
Any help would be appreciated! TIA
here's an example
http://leepoint.net/notes-java/41io/...10console.html
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.807 / Virus Database: 549 - Release Date: 12/7/2004