Assignment #127 and Displaying A File
Code
///Name: Tim Gibson
///Period: 6
///Project Name: Displaying A File
///File Name: Display.java
///Date Finished: 1/14/16
import java.util.Scanner;
import java.io.File;
public class Display{
public static void main ( String[] args ) throws Exception {
Scanner kb = new Scanner(System.in);
System.out.print("What file would you like to display: ");
String f = kb.next();
Scanner file = new Scanner( new File(f));
String line;
do {
line = file.nextLine();
System.out.println(line);
} while ( file.hasNext() == true );
}
}
Picture of the output