From 7b21727285e50b0b050c4ddd70d07542229c5366 Mon Sep 17 00:00:00 2001 From: pants Date: Mon, 21 Sep 2026 14:17:03 -0700 Subject: init --- java/countWords.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 java/countWords.java (limited to 'java/countWords.java') diff --git a/java/countWords.java b/java/countWords.java new file mode 100755 index 0000000..cd8ce98 --- /dev/null +++ b/java/countWords.java @@ -0,0 +1,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); + } +} -- cgit v1.2.3