Assignment #123

Code

    /// Name: Kabir Virk
    /// Period: 6
    /// Program Name: Simple File Input
    /// File Name: SimpleFileInput.java
    /// Date Finished: 5/25/2016
    
    import java.io.File;
    import java.util.Scanner;
    
    public class SimpleFileInput {
    
        public static void main(String[] args) throws Exception {
        
            String name;
            
            Scanner fileIn = new Scanner(new File("name.txt"));
            
            name = fileIn.nextLine();
            
            fileIn.close();
            
            System.out.println("Your name is " + name + ".");
        }
    }
 

Picture of the output

Assignment 123