0

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.

4
  • 3
    Wouldn't the Scanner class work better here? Commented Dec 8, 2015 at 12:04
  • 3
    I Know this Syntax works good for Scanner .But i want Except Scanner. Commented Dec 8, 2015 at 12:07
  • 2
    Your current code will read numbers and characters, so I am not sure what the problem is. Commented Dec 8, 2015 at 12:10
  • 2
    My problem is it doesn't take any integer value. Commented Dec 8, 2015 at 12:13

1 Answer 1

2

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);  
     }  
    }  
Sign up to request clarification or add additional context in comments.

Comments