See, Editors like netbeans have an inbuild prompt that emulate the command prompt of the OS,
However, these should not be seens as a benchmark for your system.
usually editors now a days have limited support for text input via thier console.
if you do want to have an interactive user input in a CUI interface,
run the program via the os command prompt.
The problem is that now a days CUI is obsolete, you can prepare a GUI in a matter of seconds that does the same job in a more pleasing way.
Yes, ctrl‑D is the end of file indicator for Linux/Unix/etc., but it is usually a bad idea to use it at the terminal because you are risking closing System.in. Don't therefore use while (myScanner.hasNext() ... for System.in because that will behave like an infinite loop.
John Eipe wrote:I read in a book that end of file could be given as input for a program. For Windows, it's <Ctrl> + Z.
But it never works.
Hmmm, what about using your own terminator?
It's a bit retro (1960's-retro to be exact), but it still does the job and it saves the Ctrl-D/Z problem that Campbell mentioned.
Just pick a string which should never appear in real life, and have your program terminate when it receives it.
FYI: "classic" terminators for punched-card decks were things like '$$$$' or 'ZZZZ' - which may well be where Ctrl-Z came from. :-)
Oops - Just realised this is a 9 year old thread. My apologies. :-)
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop