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()); } } }