Question: The following program contains 6 mistakes! What are they? public class Oops6 { public static void main (String [] args) { 3 Scanner in =

The following program contains 6 mistakes! What are they?public class Oops6 { public static void main (String [] args) { 3 Scanner in = new Scanner (


public class Oops6 { public static void main (String [] args) { 3 Scanner in = new Scanner ("example.txt"); 4 countWords (in); 7 // Counts total lines and words in the input scanner. public static void countWords (Scanner input) { Scanner input = new Scanner ("example.txt"); 10 int lineCount = 0; 11 int wordcount = 0; 12 13 while (input.nextLine ()) { 14 String line = input.line (); // read one line 15 lineCount++; 16 while (line.next ()) { 7/ tokens in line 17 String word line.hasNext; 18 wordCount++; 19 20 21 22 2. CO

Step by Step Solution

3.30 Rating (159 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Mistakes in Oops6 program 1 line 2 main method must say throws FileNotFoundException when const... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Building Java Programs A Back to Basics Approach Questions!