+ 4

I can't find a method to input value of the char

(char x = s.nextChar )is not allowed ☺

3rd Jun 2018, 3:06 PM
Ali N Nasser
Ali N Nasser - avatar
4 Réponses
+ 9
Scanner scan = new Scanner (System.in); char c = scan.next().charAt(0); Since Scanner class doesn't have any separate method to take char input, so take the input as string using next() and consider the 1st character of it as the char input.
3rd Jun 2018, 3:33 PM
Shamima Yasmin
Shamima Yasmin - avatar
+ 4
many thanks💓 Shamima Yasmin
4th Jun 2018, 12:06 AM
Ali N Nasser
Ali N Nasser - avatar
+ 3
java
3rd Jun 2018, 3:09 PM
Ali N Nasser
Ali N Nasser - avatar