Problem with condition | SoloLearn: Learn to code for FREE!


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. P.S. Sorry my english :D

6/27/2018 8:46:16 AM

Рома Маленко

2 Answers

New Answer


== 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”