Computer Science Canada

How do I get input and transfer it into a string variable??

Author:  DanShadow [ Wed Feb 11, 2004 3:51 pm ]
Post subject:  How do I get input and transfer it into a string variable??

I have never found a way to get the user to input something, and to save it under a variable name in Java...like, its easy in other languages.
Turing: get
C++ cin
etc.
I found something that gets integers...but it isnt helping.
code:

String number;
int choice;
System.out.print("Enter a number: ");
choice=Integer.parseInt(number);

Im pretty new at java...so any help would be greatly appreciated. Thanks!

Author:  Paul [ Wed Feb 11, 2004 5:04 pm ]
Post subject: 

For this purpose you can read my tutorial on JOptionPane, where you can use dialog boxes to input strings.
at http://www.compsci.ca/v2/viewtopic.php?t=3486


: