0

Code dont work. If clip problem.

Hello, can someone help me with my Code? At the end of the Question, there is an if Clip. No matter which answer i insert there is always the result false. Even if the variable loesung and antwort are the same. I expect the Output should be true if i insert vor antwort the same, that is set for loesung. For Example, if the variable Buchstabe is set to "a", and the user insert for the variable answer ".-". I would expect, that loesung is equal to antwort and as a result of this, the Output is true. https://code.sololearn.com/cWa2tkdaP4ap/#java Thank you for your help!

11th Aug 2019, 3:05 PM
Peter Möhle
Peter Möhle - avatar
3 odpowiedzi
+ 3
If you want to compare String line 137 you should use "equals" methods. If you use "==" you just compare memory allocation. With equals you compare values of the strings
11th Aug 2019, 3:13 PM
Michal
Michal - avatar
+ 2
Thank you for your help!
11th Aug 2019, 3:28 PM
Peter Möhle
Peter Möhle - avatar
+ 1
No problem, good luck:)
11th Aug 2019, 3:39 PM
Michal
Michal - avatar