aspose file tools*
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
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "input from console" Watch "input from console" New topic
Author

input from console

Thomas White
Ranch Hand

Joined: Feb 01, 2003
Posts: 32
Hello,
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
System.in
Thanks,
Thomas
Paul Zill
Greenhorn

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

Joined: Feb 01, 2003
Posts: 32
Paul,
Thank very much.
Thomas
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.
Thomas
(p.s the boat thing was kinda funny) :roll:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: input from console