• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Value of variable required to be entered by user.

 
Vishnu Sharma
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want in my code a String value, that is entered by the user, which method i can use for it, as we use scanf in C language.
 
Maneesh Godbole
Saloon Keeper
Posts: 11096
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where is the user going to enter? Swing component? Web component? Console?
 
Jonas Isberg
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am guessing that scanf in C takes input from the console.
One way to do that in java is to use System.in (there might
be more friendly alternatives).
 
Maneesh Godbole
Saloon Keeper
Posts: 11096
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since 1.5 the ideal way would be the java.util.Scanner class
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic