Assignemnt #123 and Simple File Input
Code
/// Name: Marco Correa
/// Period: 5
/// Program Name: Simple File Input
/// File Name: Simple File Input.java
/// Date Finished: 5/18/2016
import java.util.Scanner;
import java.io.File;
public class SimpleFileInput
{
public static void main( String[] args ) throws Exception
{
String f_name, l_name;
File in = new File("name.txt");
Scanner input = new Scanner(in);
f_name = input.next();
l_name = input.next();
System.out.println( "Using my psychic powers (aided by reading data from the file), I have" );
System.out.println( "determined that your name is " + f_name + " " + l_name );
System.out.println( "Amazing, huh?" ); // probably not so much for the code reviewers though
}
}
Picture of the output