+ 3
I have problem with "Scanner" in Java.
Hi guys! I have problem with "Scanner" in Java I need the program to request user input and then check what the user entered. If it is the letter "Y", it displays "all ok". But when I enter "Y" the program thinks that I entered not "Y" https://code.sololearn.com/cfq7i5MZS3tb/?ref=app How can I fix the problem?
2 Answers
+ 4
Hey bro you should convert your type of your variable varVar into char type.because user enter only single letter Y and in java single letter is char.
+ 3
Maninder $ingh But Scanner.nextLine() and Scanner.next() expects a String. The Scanner has no method for char.