Also available as TextIORead.java

/**
 * Title: TextIORead
 * Description: Read strings (lines) from a file named "out"
 * @author hollingd@cs.rpi.edu
 */
import java.io.*;

class TextIORead {

        public static void main(String [] args ) {

                try {
                        // create a buffered reader
                        BufferedReader in = new BufferedReader(new FileReader("out"));
                        boolean done=false;

                        while (!done) {
                                String s = in.readLine();
                                if (s!=null)
                                        System.out.println(s);
                                else
                                        done=true;
                        }
                        in.close();
                } catch (IOException e) {
                        e.printStackTrace();
                }
        }
}