The readLine() method of java.io.BufferedReader class reads the next line from a text file. When it reaches the end of the file it will return null.
BufferedReader in = new BufferedReader(new FileReader(filename)); String line = null; while (null!=(line=in.readLine())) { // process each line of file her // 'line' variable contains next line in file } in.close();