Assignemnt #127 Displaying A File
Code
///Name: Joshua Pell
///Period: 6
///Project Name: Displaying A File
///File Name: displayFile.java
///Date: 6/3/2015
import java.util.Scanner;
import java.io.File;
public class displayFile
{
public static void main( String[] args ) throws Exception
{
Scanner scan = new Scanner( System.in );
System.out.print( "Open which file: " );
String which = scan.next();
Scanner fileIn = new Scanner( new File(which));
while ( fileIn.hasNext() )
{
System.out.println( fileIn.nextLine());
}
}
}
Picture of the output