Question: how do I do this one I can not figure it out 1 . The following program contains 6 errors. ` ` ` public class
how do I do this one I can not figure it out
The following program contains errors.
public class Mystery
public static void mainString args
Scanner in new Scannerexampletxt;
countWordsin;
counts total lines and words in the input scanner.
public static void countWordsScanner input
Scanner input new Scannerexampletxt;
int lineCount ;
int wordCount ;
while inputnextLine
String line input.line; read one line
lineCount;
while linenext tokens in line
String word line.hasNext;
wordCount;
System.out.printlnLines: lineCount;
System.out.printlnWords: wordCount;
Correct the errors and submit a working version of the program. The corrected version of the program should produce the following output:
Lines:
Words:
when it is run on the following input file, example.txt:
hello how are you
I am fine
This line has a large number of words on it
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
