Question: JAVA question Rearrange the following lines to produce statements that read a file and print all words in the file, one per line to another

JAVA question
Rearrange the following lines to produce statements that read a file and print all words in the file, one per line to another file, with lines numbered 1., 2., 3., and so on. Mouse: Drag/drop Keyboard: Grab/release Spacebar (or Enter). Move Cancel Esc Unused ReadAFile.java Load default template... in.close(); out.close(); out.println(counter + import java.util.Scanner; import java.io.PrintWriter; import java.io.File; import java.io.FileNotFoundException; ".." + word); int counter = 0; Scanner in = new Scanner(new File("input.txt")); public class ReadAFile { public static void main (String [] args) throws FileNotFoundException { String word = in.next(); PrintWriter out = new PrintWriter("words.txt"); counter++; while (in.hasNext() { } 1 }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
