Simple File Input

Code

    /// Name: Rachel Smith
    /// Period: 5
    /// Program Name: Simple File Input
    /// File Name: SimpleFileInput.java
    /// Dtae Finished: 2/19/2016
    
    import java.io.File;
    import java.util.Scanner;
    
    public class SimpleFileInput {
        
        public static void main(String[] args)throws Exception {
            
            String myName;
            
            Scanner name = new Scanner(new File("SimpleFileInput.txt"));
            myName = name.nextLine();
            
            name.close();
            
            System.out.println( "Your name is: " + myName );
            
        }
    }

    

Picture of the output

Assignment 1