Question: please write down the output thank u //This is a java program to read a txt file and sort it then output it import java.util.Scanner;

please write down the output thank u //This is a java programto read a txt file and sort it then output it importjava.util.Scanner; import java.io.*; import java.uti1.ArrayList; import java.util.Collections; import java.util.List; public class Lab10Ex1please write down the output

thank u

//This is a java program to read a txt file and sort it then output it import java.util.Scanner; import java.io.*; import java.uti1.ArrayList; import java.util.Collections; import java.util.List; public class Lab10Ex1 public static void main(Stringt args) throws IOException List NL = new ArrayList(); //creating a arraylist to contai! the sorted data File file = new File ( "Name .txt"); //cre a ring a new file object named file and read the Name . txt file Scanner inputFile = new Scanner (file); //Using scanner to read the file //while the scannered file has next token the program will add that line into arraylist while(inputFile.hasNextO) string line- inputFile.nextLine)iL NL.add (line) System.out.println("The name list before sort"//print the unsorted list out for(String unsort:NL) System.out.println(unsort) Collections.sort (NL) inputFile.close)i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

This Java program reads lines from a file named Nametxt sorts them and prints the list before ... 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 Databases Questions!