Java Reference
In-Depth Information
Reading Strings
To read a string from the keyboard, use the version of readLine( ) that is a member of the
BufferedReader class. Its general form is shown here:
String readLine( ) throws IOException
It returns a String object that contains the characters read. It returns null if an attempt is
made to read when at the end of the stream.
The following program demonstrates BufferedReader and the readLine( ) method. The
program reads and displays lines of text until you enter the word “stop”.
Search WWH ::




Custom Search