File I/O Part 1 #123 (Don't look back, always look ahead...)

Code

/// Name: Amir Salehi
/// Period: 7
/// 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;
            
            System.out.println( "Getting your info .... Beep .... beep... beep " );
            
            Scanner fileIn = new Scanner(new File("name.txt"));
            
            name = fileIn.nextLine();
            
            fileIn.close();
            
            System.out.println( "Your name is " + name + "." );
        }
    }  





    

Picture(s) of the output

Assignment 7

Back to Homepage