/* Loops9.java CIS 160 David Klick 2004-09-20 Demonstrates alternative to priming read */ import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class Loops9 { public static void main(String[] args) throws IOException { String strIn; int line = 0; BufferedReader in = new BufferedReader(new FileReader("loopdata.txt")); do { strIn = in.readLine(); if (strIn != null) { line++; System.out.println(line + ": " + strIn); } } while (strIn != null); in.close(); } }