Read a file name from the console. The file contains words separated by punctuation marks. Output to the console the number of times the word "world" appears in the file. Close the streams.
You must be signed in to leave a comment
3 March, 13:16
Easy task. Just one Stream API pipeline.
14 October 2021, 15:09
Two things likely to trip you up on this task that, on the surface, looks extremely simple: 1. FileReader.read returns a character in numeric form. You must cast it correctly to append it to a string. 2. The word "world" must appear by itself, not as part of another word. So you can't just loop through String.indexOf.
21 September 2021, 12:07
A more precise description of the task is: - "The file contains words separated by punctuation marks and/or whitespaces." - the words "world" count only in lower case. - "worlds", "worldly" : these do not count.
28 April 2020, 07:38
Hey Crew. So what worked for me on this one was the following. Convert the file to an ArrayList<Character> charArray... containing each char in the file. Convert charArray into ArrayList<String> words using the ASCII value for characters. (97 to 122 for lower case.. Character.toLowerCase() ) Check if each of those words equals "world" using a for loop. Hope this helps!
27 May 2019, 12:34
"Determine why the program found more instances of the word "world " than exist in the file." I don't know why? when I check it with file on my PC it works.
25 November 2018, 08:56
Can anyone help me on this, not sure what is going wrong
26 November 2018, 07:29
If you need help, something isn't right in your code, the server won't accept your solution (even if you are 100% sure that it is correct). Describe your question/issue in the HELP section at codegym.cc/help.