Problem with condition | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
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 Resposta
+ 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