改行は文字数に入れてない
import java.io.*;
class b {
public static void main(String[] args) throws IOException {
if (args.length > 0) {
BufferedReader br = new BufferedReader(new FileReader(args[0]));
int lines = 0;
int chars = 0;
String str;
while ((str = br.readLine()) != null) {
lines++;
chars += str.length();
}
System.out.println(chars + " characters, " + lines + " lines");
}
}
}