Thread: cin >> in java?
View Single Post
Old 03-17-2003, 07:40 PM   PM User | #3
Spookster
Supreme Overlord


 
Spookster's Avatar
 
Join Date: May 2002
Location: Marion, IA USA
Posts: 6,224
Thanks: 4
Thanked 80 Times in 79 Posts
Spookster will become famous soon enough
As psp mentioned you will need to import the java.io

and then something like this will work just fine:

BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

then you can use method like readLine() to read in the input:

int input;

input = Integer.parseInt(br.readLine());
__________________
Spookster
CodingForums Supreme Overlord
All Hail Spookster
Who gave you that Ugging infraction? Yeah that's right it was me!
Spookster is offline   Reply With Quote