Assignemnt #127 Displaying a File
Code
///Name: Prooz Fereydouni
///Period: 7
///Project Name: Displaying a File
///File Name: DAF.java
///Date: 5/28/2016
import java.util.Scanner;
import java.io.File;
public class DAF {
public static void main(String[] args) throws Exception{
Scanner kb = new Scanner(System.in);
String txt;
System.out.println("What file would you like to scan? ");
txt = kb.next();
Scanner scan = new Scanner(new File(txt));
while (scan.hasNext()) {
String a = scan.nextLine();
System.out.println(a);
}
}
}
Picture of the output