Program in Java to input roll no and name of a student using BufferedReader class and print the details
Program Code:
package javaapplication1;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class JavaApplication1 {
public static void main(String[] args) throws IOException{
InputStreamReader r=new InputStreamReader(System.in);
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);
}
}
Output:
Enter your Roll No 1 Enter your name Sheetal Garg Your Roll No is 1 Your Name is Sheetal Garg