Sep 23

The readLine() method of class reads the next line from a text file. When it reaches the end of the file it will return null.

List<String> lines = new ArrayList<String>();
BufferedReader in = new BufferedReader(new FileReader(filename));
String line = null;
while (null!=(line=in.readLine()))

// lines will now contain the contents of the file

written by objects \\ tags: ,

Leave a Reply

You must be logged in to post a comment.