Alright I finished my program however, I need a counter for words. The program below counts words that end with a space.
I need to do an || statement or a different loop to count words that also...
Type: Posts; User: Usoda
Alright I finished my program however, I need a counter for words. The program below counts words that end with a space.
I need to do an || statement or a different loop to count words that also...
I didn't know you had to assign it. I thought char currentChar; would be all you had to do to initialize it. I guess I was wrong though.
Hey man I feel yeah. I got another error:
The local variable currentChar may not have been initialized
I am going to take a break because I am becoming frustrated, and can't stand to stare at...
Sorry to be so bothersome, but now it is saying:
The method isWhitespace(char) in the type java.lang.Character is not applicable for the arguments ()
I don't understand why it is trying to...
Tjstretch with your method I get an error "Cannot invoke isDigit on the primitive type char?" on both isDigit and isWhitespace
Tjstretch I have not read your post yet. I just now created this which counts everything, but it doesn't combine the values.
while (input.hasNextLine()) {
last = input.nextLine();
...
I am still unsure how to increment a counter to tell me how many characters, digits, and blank spaces. Also, is there a way to do this with methods from class Character?
I am reading a file from the user and now I have to count the number of characters, blank spaces, digits, "other characters", words, and lines in a text file using a loop.
I am having trouble...