Assignment #127 and Displaying A File
Code
///John Mulligan
///period 5
///Program Name: DisplayingAFile
///File Name: DisplayingAFile.java
import java.util.Scanner;
import java.io.File;
public class DisplayingAFile {
public static void main(String[] args) throws Exception{
Scanner kb = new Scanner(System.in);
String fn;
System.out.println("Please state the name of the file that you want us to display");
fn = kb.next();
Scanner reader = new Scanner(new File(fn));
while (reader.hasNext()) {
String l = reader.nextLine();
System.out.println(l);
}
}
}