New course! Every coder should learn Generative AI!
Try a free lesson0
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!
3 Answers
+ 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
+ 2
Thank you for your help!
+ 1
No problem, good luck:)