Write a program to reverse the lines of a file and also toreverse the order of the words in each line of the file. UseArrayLists to help you.
Solution
import java.io.File;import java.io.FileNotFoundException;import java.io.PrintWriter;import java.util.ArrayList;import java.util.Scanner;public class ReverseLinesWords { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print(“Enter file name: “); File file = new File(in.nextLine()); try {
OR
OR