Assignment 123; SimpleName
Code
// Donovan Rich
// Period 6
// Simple File Input
// RetrievingName
// 6/9/2016
import java.io.File;
import java.util.Scanner;
public class SimpleName {
public static void main(String[] args) throws Exception {
String first, last;
System.out.println("Hello, Operator! Retrieving identification data.");
Scanner fileIn = new Scanner(new File("name.txt"));
first = fileIn.nextLine();
last = fileIn.nextLine();
fileIn.close();
System.out.println("Operator recognized. Greetings, " + first + " " + last + ".");
}
}
Picture of the output