Assignment #123
Code
/// Name: Matthew Lorence
/// Period: 5
import java.io.File;
import java.util.Scanner;
public class SimpleFile {
public static void main(String[] args) throws Exception {
Scanner fileIn = new Scanner(new File("name.txt"));
String first = fileIn.next();
String last = fileIn.next();
fileIn.close();
System.out.println("Using my psychic powers (aided by reading data from the file), I have");
System.out.println("Determined that your name is " + first + " " + last + ".");
}
}
Picture of the output