class ReadData { public static void main(String[] args) { TextReader inFile; String fileName = "data.txt"; inFile = new TextReader(fileName); int number; if ( inFile.fail() ) { System.err.println("Can't open " + fileName); System.exit(1); } number = inFile.readlnInt(); while ( !inFile.eof() ) { System.out.println(number + " "); number = inFile.readlnInt(); } // System.out.println(number + " "); inFile.close(); } }