Advertisement
Guest User

Untitled

a guest
Oct 1st, 2014
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.32 KB | None | 0 0
  1. try {
  2.  
  3.             br = new BufferedReader(new FileReader(f));
  4.             String line;
  5.             while ((line = br.readLine()) != null) {
  6.  
  7.                 lines++;
  8.                 chars += System.getProperty("line.separator").length();
  9.                 chars += line.length();
  10.                 words += line.split(" ").length;
  11.  
  12.             }
  13.  
  14.             System.out.println(lines + " " + words + " " + chars);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement