blob: 8aba15d109ee3ec3f669d59eac290ef0863e1a29 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
import java.util.*;
import java.io.*;
public class wordcount {
public static void main(String[] args) throws FileNotFoundException {
File input = new File(args[0]);
Scanner fileScanner = new Scanner(input);
int count = 0;
while (fileScanner.hasNext()) {
String nextToken = fileScanner.next();
count++;
}
fileScanner.close();
System.out.println(count);
}
}
|