Question:

How can user......Java?

by  |  earlier

0 LIKES UnLike

How can user enter one char only, I know How he can enter string like

Scanner reader=new Scanner(System.in);

String text=reader.next();

but, How can I make statement with char ??

 Tags:

   Report

2 ANSWERS


  1. BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    char c = 'c';

    System.out.println("Enter char: ");

    try {

    c = (char)br.read();

    } catch(IOException e) {

    System.out.println("IOException");

    }

    System.out.println("Your char is " + c);


  2. is there a   getchar() = variable; function?

Question Stats

Latest activity: earlier.
This question has 2 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.