/* Loops10.java CIS 160 David Klick 2004-09-22 Sentinel controlled loop using for statement (not advised) */ import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class Loops10 { public static void main(String[] args) throws IOException { String strIn; int line = 0; BufferedReader in = new BufferedReader(new FileReader("loopdata.txt")); for (strIn=in.readLine(); strIn != null; System.out.println(++line + ": " + strIn), strIn=in.readLine()); in.close(); } }