+ 2
Char in Scanner Java
How to scan single char in java? coz thr is no method like char nextChar() and String have multiple characters.
2 ответов
+ 1
Scanner scan = new Scanner(System.in);
System.out.println("What's your name?");
scan.hasNext();
... is that what you mean?
+ 1
I found this on stackoverflow:-
char c = scanner.next().charAt(0);
its working.