PROGRAMMING AND CODE


Assignemnt #123

Code

/// Name: Justin Li
/// Period: 7
/// Program Name: Simple File Input
/// File Name: SimpleFileInput.java
/// Date Finished: 6/3/2016

import java.io.File;
import java.util.Scanner;

public class SimpleFileInput {

    public static void main(String[] args) throws Exception {

        String name;

        System.out.print("I guess that your name is: ");

        Scanner fileIn = new Scanner(new File("name.txt"));

        name = fileIn.nextLine();

        fileIn.close();

        System.out.println(name);
    }
}

    

Picture of the output

Assignment 1