write code to get a specific word from a file. And the number of times word occurs in this file should be written to new file. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

write code to get a specific word from a file. And the number of times word occurs in this file should be written to new file.

You need to write a code to find the occurrence of a specific word from a file. And then result should be shown in new file. Please provide the code. Anyone please. Code should be written in Java.

28th May 2018, 12:49 PM
Avadhesh Pal
Avadhesh Pal - avatar
1 Answer
+ 3
Don't know the code, but i could outline the steps: * Read the file words one at a time using "while" loop. * Compare the word you want checked with each of the words in the file. * each time the above condition's true, increment the value of variable "count" ( which stores the no. of times your specific word appears ) by 1.
28th May 2018, 12:58 PM
Rahul George
Rahul George - avatar