0
Hello i just want to ask what's wrong with the code i've created. if i use "==" it gives me a wrong answer.
>> This is the code that gives me the wrong answer. https://code.sololearn.com/c6Ew9h2bUgnP/?ref=app >> This is the codes i used to give me the right one. instead of "==" i used .equals(). https://code.sololearn.com/cNj6pYBceGAj/?ref=app
4 Réponses
+ 3
In java if you compare strings with == and the strings are different objects it returns 0.
I was wrong before (i only read half of it).
This is where i found it: https://www.google.com/amp/s/www.geeksforgeeks.org/compare-two-strings-in-java/amp/
+ 1
At the end of your code is one } to much