+ 1
Why is the result were not true?
I'm trying to test if the input username of the user match with the username in User class. https://code.sololearn.com/cvQB819ecied/?ref=app
2 Réponses
+ 3
Use the equals method instead of == because you want to compare the values. As is, it will always evaluate to false because it's checking if user1 and username1 are pointing to the same memory address.
if(user1.equals(username1))
+ 2
Thank you