// Lists contents of a user-specified file 

import java.io.*;

public class FileLister {

	// main(): application entry point
	public static void main(String [] args) throws IOException {
		// set up standard input stream 
		BufferedReader stdin = new BufferedReader(
				new InputStreamReader( System.in ) );

		// determine filename
		System.out.print("Filename: ");
		String filename = stdin.readLine();

		// set up file stream 
		BufferedReader fileIn = new BufferedReader(
				new FileReader( filename ) );

		// process lines one by one 
		String currentLine = fileIn.readLine();  // get first line

		while (currentLine != null) {
			// display current line 
			System.out.println(currentLine);

			// get next line 
			currentLine = fileIn.readLine();
		}

		// close the file stream
		fileIn.close();
	}
}

