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

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

6/27/2018 8:46:16 AM

Рома Маленко

2 Answers

New Answer

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