Write a program that takes a file name as argument and counts the number of words and the number of characters (without spaces) in the document.
The Attempt at a Solution
How exactly should my program take a .txt file as an argument? Do I simply:
String str = args;
And the contents of the .txt file are stored as strings? (The file is a text file with only letters).
And how to check for each word inside that file? Let it read the string till encountering a space then (by previously declaring a count variable) increment count? I'm confused here. Is it that same as just studying a string?