This repository has been archived on 2026-03-18. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
CSE-122/wordcount.java
2026-03-18 00:39:22 -07:00

19 lines
451 B
Java

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);
}
}