summaryrefslogtreecommitdiff
path: root/java/countWords.java
blob: cd8ce98fd732108480d9e29ff04805ef5bd5f8ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import java.io.*;
import java.util.*;

public class countWords {
    public static void main(String[] args) throws FileNotFoundException {
        Scanner fileScanner = new Scanner(new File(args[0]));
        int count = 0;
        while (fileScanner.hasNext()) {
            count++;
            String dummy = fileScanner.next();
        }
        System.out.println(count);
    }
}