Write Program Reverse Lines File Also Reverse Order Words Line File Use Arraylists Help Q37100775

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

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.