Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis+ 3
Como comparar dos variables de tipo String en java?.
Si comparo dos String con el mismo texto mediante == porque no me da true?
1 Resposta
+ 13
The "=="Ā operator compares the value ofĀ two object referencesĀ to see whether they refer to the sameĀ String instance while the equals()Ā methodĀ compares the "value" inside String instances (on the heap) irrespective of the two object references refer to the same String instance or not.
P.S. That's the reason why "==" resulted in false! You should use the equals() method when comparing two Strings.