Assignment #127 Displaying a File

Code

    /// Name: John Huh
    /// Period: 6
    /// Program Name: Displaying a File
    /// File Name: Display.java
    /// Date Finished: 5/23/2016
    
    import java.io.File;
    import java.util.Scanner;
    public class Display {
    
        public static void main(String[] args) throws Exception {
    
            String file;
            Scanner keyboard = new Scanner(System.in);
            
            System.out.println();
            System.out.print( "Open which file: " );
            file = keyboard.next();
    
            Scanner fileIn = new Scanner(new File(file));
            do
            {
            System.out.println( fileIn.nextLine() );
            } while ( fileIn.hasNext() );
            fileIn.close();
            System.out.println();
        }
    }
    

Picture of the output

Assignment 1