Go Back   CodingForums.com > :: Server side development > Java and JSP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-15-2003, 11:20 PM   PM User | #1
chipdouglas
New to the CF scene

 
Join Date: Mar 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
chipdouglas is an unknown quantity at this point
cin >> in java?

that's my question. i hope this posts, cause it wouldn't the first 2 times i tried
chipdouglas is offline   Reply With Quote
Old 03-17-2003, 04:33 AM   PM User | #2
psp
New Coder

 
Join Date: Mar 2003
Location: CA
Posts: 18
Thanks: 1
Thanked 0 Times in 0 Posts
psp is an unknown quantity at this point
I guess your question is "what is the java equivalent of c++'s cin".
There is no direct thing.You need to import java.io and see the classes in them and look for the one which is suitable for your purpose(example: DataInputStream Class)
Go through the java documentation for the classes in the package "java.io"
psp is offline   Reply With Quote
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,234
Thanks: 4
Thanked 81 Times in 80 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
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:30 AM.


Advertisement
Log in to turn off these ads.