Home Segments Top Top Previous Next

477: Mainline

To read a line of text, you first need to construct an instance of the BufferedReader class from an input-stream reader:

                      Input stream reader --* 
                                            | 
                                            v 
BufferedReader buffer = new BufferedReader(reader); 

Then, you can read a line of text, producing a string, using the readLine method:

buffer.readLine() 

If there are no more lines of text in a file, then the readLine method returns null.