CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   Java and JSP (http://www.codingforums.com/forumdisplay.php?f=54)
-   -   cin >> in java? (http://www.codingforums.com/showthread.php?t=16440)

chipdouglas 03-15-2003 11:20 PM

cin >> in java?
 
that's my question. i hope this posts, cause it wouldn't the first 2 times i tried

psp 03-17-2003 04:33 AM

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"

Spookster 03-17-2003 07:40 PM

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());


All times are GMT +1. The time now is 09:15 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.