Assignemnt #127 and Displaying A File
Code
/// Name: Raff Lisbona
/// Period: 6
/// Program Name: Displaying A File
/// File Name: DisplayingAFile.java
/// Date Finished: 5/27/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