Assignemnt #127
Code
/// Name: Sam Menar
/// Period: 6
/// Program Name: Displaying A File
/// File Name: DisplayingAFile.java
/// Date Finished: 6/1/2016
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.print("Open which file? ");
fn = kb.next();
Scanner reader = new Scanner(new File(fn));
while (reader.hasNext())
{
String done = reader.nextLine();
System.out.println(done);
}
}
}
Picture of the output
\