Assignment 127, Displaying a File
Code
///Name: Stella Koliavas
///Period: 5
///Program Name: Display
///File Name: display.java
///Date Finshed: 6/06/16
import java.util.Scanner;
import java.io.File;
public class display
{
public static void main( String[] args ) throws Exception
{
Scanner scan = new Scanner( System.in );
System.out.print( "Open which file: " );
String which = scan.next();
Scanner fileIn = new Scanner( new File(which));
while ( fileIn.hasNext() )
{
System.out.println( fileIn.nextLine());
}
}
}
Picture of the output