Reputation:
I want this Syntax Except Scanner.I know Scanner Works good for this program.
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter USN:");
String usn=br.readLine();
I want to accept both integer and character type input from the keyboard in a single line.
Upvotes: 0
Views: 1635
Reputation: 556
Run this code
import java.io.*;
class G5{
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 "+name);
}
}
Upvotes: 2