0
Getting user input
How can a user input only one character.
1 ответ
+ 3
You can get the next word and take only the first character as input.
Scanner sc = new Scanner(System.in);
char c = sc.next().charAt(0);
or, you can use the same technique with .next(), and reject the input if .length() is found to exceed 1.