You can use this:


// some piece of code

        InputStreamReader in = new InputStreamReader( System.in );
        BufferedReader br = new BufferedReader(in);
        String lineFromUser = br.readLine( ); // This line will block to the user take 
an "ENTER" (CR, LF or CR+LF).
        System.out.println( lineFromUser ); // This will display the line at out (so, 
the line should be repeated 2 times: one from user input (echo) and second from this 
line.

// good look!!! 

Please, note that I've not tested this piece of code, since I use only Swing at my 
apps.. But I use this code to read data from network all the time, and this works fine 
for me...


--------------------------------
Edson Richter



----------
From:   Weiqi Gao
Sent:   quinta-feira, 30 de dezembro de 1999 10:04
To:     [EMAIL PROTECTED]
Cc:     java-linux
Subject:        Re: Do you have any example showing us how to read a line. an 
interger,a float... from console?

[EMAIL PROTECTED] wrote:
> 
> Hello everybody,
> 
> Have you got any example like that? It's because there are so many
> classes in java.io that I don't know what to choose to do it.

Get the Java I/O book from O'Reilly.  It has examples that does that.

-- 
Weiqi Gao
[EMAIL PROTECTED]


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to