Basic in java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Basic in java

Hello, so I learned to how obtain a number from the user... number = in.nextInt(); My question is, how do I get the user to input a char? I have noticed there isn't a command which approves nextChar Thanks :)

27th Feb 2017, 10:45 PM
Eliran Darshan
Eliran Darshan - avatar
4 Answers
+ 5
by using .next() instead of .nextint()
28th Feb 2017, 12:10 AM
Badr AKKI
Badr AKKI - avatar
0
hi
27th Feb 2017, 10:49 PM
Îɱ FîgHtêr
Îɱ FîgHtêr - avatar
0
just use in.next() char = in.next();
27th Feb 2017, 10:58 PM
Alimie
Alimie - avatar
0
Thank you guys!
1st Mar 2017, 9:48 AM
Eliran Darshan
Eliran Darshan - avatar