Assignemnt #123 and Simple File Input
Code
///Name: Daniel Tiffany-Appleton
///Period: 7
///Program Name: Simple File Input
///File Name: SimpleFileInput
///Date Finished: 3/28/16
import java.util.Scanner;
import java.io.File;
public class SimpleFileInput
{
public static void main( String[] args ) throws Exception
{
Scanner fileIn = new Scanner(new File("name.txt"));
String firstName = fileIn.nextLine();
String lastName = fileIn.nextLine();
fileIn.close();
System.out.println("Using my psychic powers (aided by reading data from the file),");
System.out.println("I have determined that your name is " + firstName + "" + lastName + ".");
}
}
Picture of the output