+ 1

[Solved]Somewhat lost on how to compare string input to a literal.

https://code.sololearn.com/cz2nlzj77wtd/?ref=app Somewhat get the feeling that "next()" might be inserting an escape character or something, but im lost.

8th Jul 2021, 9:46 PM
D😂
D😂 - avatar
3 Answers
+ 3
in java you cannot use == to compare strings... you must use equals() method: https://www.javatpoint.com/java-string-equals
8th Jul 2021, 10:02 PM
visph
visph - avatar
+ 3
== compares object references . If you want to compare values use equals method .
8th Jul 2021, 10:03 PM
Abhay
Abhay - avatar
+ 2
Well, now i miss Python lol, thanks for helping out!
8th Jul 2021, 10:05 PM
D😂
D😂 - avatar