Pergunta de entrevista da empresa PureSoftware

Q - Difference between String equals and == comparator

Resposta da entrevista

Sigiloso

17 de out. de 2024

== does check by reference so String str = "Hello" and str2 = "Hello" str3 = new String("Hello") will be true for str === str2 but not for str3 == str as the memory location/reference is different. But str3.equals(str) will be true