Assignment #123 and Simple File Input
Code
/// Name: Ali Kurland
/// Period: 6
/// Program Name: Simple File Input
/// File Name: SimpleFileInput.java
/// Date Finished: 5/9/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("Using my psychic powers (aided by reading data from the file), I have");
Scanner fileIn = new Scanner(new File("name.txt"));
name = fileIn.nextLine();
fileIn.close();
System.out.println("Determined that your name is " + name + "." );
}
}
Picture of the output