Assignment #123 Simple File Input

Code

    /// Name: John Huh
    /// Period: 6
    /// Program Name: Simple File Input
    /// File Name: FileInput.java
    /// Date Finished: 5/17/2016
    
    import java.io.File;
    import java.util.Scanner;
    
    public class FileInput {
    
        public static void main(String[] args) throws Exception {
    
            String firstname, lastname;
    
            Scanner fileIn = new Scanner(new File("name.txt"));
    
            firstname = fileIn.nextLine();
            lastname = fileIn.nextLine();
    
            fileIn.close();
            
            System.out.println();
            System.out.println("Using my psychic powers (aided by reading data from the file), I have");
            System.out.println("Determined that your name is " + firstname + " " + lastname + "." );
            System.out.println();
            
        }
    }
    

Picture of the output

Assignment 1