Buffered Reader in java

Java BufferedReader class is used to read the text from a character-based input stream. It can be used to read data line by line by readLine() method. It makes the performance fast. It inherits Reader class. Java BufferedReader class declaration Let’s see the declaration for Java.io.BufferedReader class: public class BufferedReader extends Reader

/* JAVA program to understand Buffered Reader */
/* www.codewindow.in */

import java.io.*;
public class codewindow
{
    public static void main(String args[])throws Exception
    {
        InputStreamReader r=new InputStreamReader(System.in);
        BufferedReader br=new BufferedReader(r);
        System.out.println("Enter your name");
        String name=br.readLine();
        System.out.println("Welcome to codewindow "+name);
    }
} 

Output

Enter your name
Sourav
Welcome to codewindow Sourav

Latest Posts

Archives

Leave a Comment

Your email address will not be published. Required fields are marked *