• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

input from console

 
Thomas White
Ranch Hand
Posts: 32
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 28
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Thomas White
Ranch Hand
Posts: 32
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul,
Thank very much.
Thomas
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Thomas White
Ranch Hand
Posts: 32
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic