PureSoftware interview question

Q - Difference between String equals and == comparator

Interview Answer

Anonymous

17 Oct 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