File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes input from console Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "input from console" Watch "input from console" New topic

input from console

Thomas White
Ranch Hand

Joined: Feb 01, 2003
Posts: 32
I have a simple (somewhat embarrasing question).
In java how do you read an integer value from the console? ie) In C scanf("%d", &intvariable).
I'm assuming it has something to do with
Paul Zill

Joined: Jun 12, 2003
Posts: 28
Thomas White
Ranch Hand

Joined: Feb 01, 2003
Posts: 32
Thank very much.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
If you were going to do a lot of command window apps, you might want a utility with functions like:

Each function could display the prompt, get something from the user, tell them if they made an error, try again until good, or maybe recognize a special response that means I Give Up, Stop The Program!
I had such routines back in mainframe days that read date and number ranges, required a match on a list of strings, displayed little numbered menus, provided default values, etc. But I haven't done enough command-line Java programs to write them again.
(Ok, that boat thing was very lame )
[ July 23, 2003: Message edited by: Stan James ]

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Thomas White
Ranch Hand

Joined: Feb 01, 2003
Posts: 32
Hey Stan,
That's a great idea. Thanks for the advice.
(p.s the boat thing was kinda funny) :roll:
I agree. Here's the link:
subject: input from console
Similar Threads
how to find port number
simple code ! char conversion
please correct the code
write method