import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;


public class FileDemo {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		PrintWriter prt1 = new PrintWriter(System.out);
		prt1.print("Your name ? ");
		prt1.flush();
		BufferedReader reader1 = new BufferedReader(new InputStreamReader(System.in));
        prt1.println ("\n Hello " + reader1.readLine());
        prt1.close();
		
		
		try {
			PrintWriter prt = new PrintWriter("/home/ericm/Desktop/file2");
			prt.println("Hello");
			prt.close();
		} catch (FileNotFoundException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		
		
		try {
			BufferedReader reader = new BufferedReader (new FileReader("/home/ericm/Desktop/file"));
			String line;
			int i = 1;
			while ((line = reader.readLine()) != null) {
				System.out.println(i + " " + line);
				i++;
			}
			
			
		} catch (FileNotFoundException e) {
		  System.out.println("Cannt find file");
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}

