Is there an easy way of counting line numbers? Or do you have to go through the entire file?
Created Aug 17, 2001
Shahram Khorsand You have to go through the entire file.
try {
LineNumberReader lnr = new LineNumberReader(new FileReader(filename));
String s;
while ((s = lnr.readLine()) != null);
System.out.println("Lines: " + lnr.getLineNumber());