Asignment: #123 Simple File Input
Code
/// Name: Sean Harrison
/// Period: 7
/// Program name: SimeFile
/// File Name: Simplefile.java
/// Date Finished: 5/24/2016
import java.io.File;
import java.util.Scanner;
public class SimpleFile {
public static void main(String[] args) throws Exception {
String name;
System.out.print("I know that your name is: ");
Scanner fileIn = new Scanner(new File("name.txt"));
name = fileIn.nextLine();
fileIn.close();
System.out.println(name);
}
}
Picture of the output