Program to explain use of BufferedReader class in Java

Program in Java to input roll no and name of a student using BufferedReader class and print the details

Program Code:

package javaapplication1;


public class JavaApplication1 {

    public static void main(String[] args) throws IOException{

    InputStreamReader r=new InputStreamReader(;    
    BufferedReader br=new BufferedReader(r);  

    System.out.println("Enter your Roll No"); 
    int rn= Integer.parseInt(br.readLine());

    System.out.println("Enter your name");    
    String name=br.readLine();   

    System.out.println("Your Roll No is " + rn);
    System.out.println("Your Name No is " + name);      


Enter your Roll No
Enter your name
Sheetal Garg
Your Roll No is 1
Your Name is Sheetal Garg
error: You can only copy the programs code and output from this website. You are not allowed to copy anything else.