1package com.javatpoint;
2import java.io.*;
3public class BufferedReaderExample {
4 public static void main(String args[])throws Exception{
5 FileReader fr=new FileReader("D:\\testout.txt");
6 BufferedReader br=new BufferedReader(fr);
7
8 int i;
9 while((i=br.read())!=-1){
10 System.out.print((char)i);
11 }
12 br.close();
13 fr.close();
14 }
15}
1package com.javatpoint;
2import java.io.*;
3public class BufferedReaderExample{
4public static void main(String args[])throws Exception{
5 InputStreamReader r=new InputStreamReader(System.in);
6 BufferedReader br=new BufferedReader(r);
7 System.out.println("Enter your name");
8 String name=br.readLine();
9 System.out.println("Welcome "+name);
10}
11}