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

3rd Jun 2020, 4:31 PM
Mark
Mark - avatar
4 ответов
+ 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/
3rd Jun 2020, 5:06 PM
Paul
Paul - avatar
+ 1
At the end of your code is one } to much
3rd Jun 2020, 4:45 PM
JaScript
JaScript - avatar