0

Problem with condition

Why is the condition in the code executed after else. In the console I write "help" (without paws), but the result is the one that after else. https://code.sololearn.com/cbYB3Lq0aEvV/?ref=app P.S. Sorry my english :D

27th Jun 2018, 8:46 AM
Рома Маленко
Рома Маленко - avatar
1 Odpowiedź
+ 3
== will compare two references of the String object, not the contents of the String object to solve your condition use this: if ("help".equals(e)){ —> compare the contents and you get “hello”
27th Jun 2018, 8:55 AM
asa22