System.out.println happens to be the display or print statement of Java for outputting Strings etc. What is the method that enables the user to get data from the user like in forms, or in a program that requires a user to input data. Thanks. Joshua
For "forms" you're probably talking about Swing or AWT GUI on a fat client, or maybe HTML forms on a web client. These are pretty involved topics. If you want to write programs that just run on your PC, try the Sun Swing Tutorial
For command line programs System.out does the writing, so it makes sense that System.what? will do the reading. You'll have to dig into buffered readers and such to read a line a time from the user. Take a shot at it and post what you come up with. The gang here will help you tweak it from there.
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
What is the method that enables the user to get data from the user like in forms, or in a program that requires a user to input data.
Well, those are two different things. Michael already posted the answer for a text field in a GUI (like in Windows Forms).
For a command line program, you can read a line from stdin and parse it to extract a number from it. If you are using Java 5, there's a simpler way. You can use the new class java.util.Scanner. You wrap a scanner around anything that can be a suitable source of chars, such as the input stream System.in. Here's an example:
This is a lot simpler than before! There are nextFOO() methods for each primitive type and for object types that make sense, like String. This isn't raw I/O - the input isn't watched char by cahr, so the user has to type return before any of it is seen.
Anyway, if you are using Java 5, you will enjoy this.
Author of <a href="http://www.amazon.com/exec/obidos/ASIN/0131482114/ref=jranch-20" target="_blank" rel="nofollow">Just Java(TM) 2 (6th Edition)</a>