I read as below
.equals() method present in object class also meant for reference comparison only based on our requirement we can override for content comparison.(i thought == do reference comparison not .equals() method???)
In String class, all wrapper class and all collection classes .equals() method is overridden for content comparison.
String s1= new String("john")
String s2= new String("john")////as attached in picture. So by not seeing picture, we cannot say both s1, s2 refer to same john object or different john object(which is case here)??
String s3= new String("mike")
String s4= new String("mike")//as attached in picture. So by not seeing picture we cannot say both s3, s4 refer to same mike object(which is case here) or different mike object??
s3==s4 is true since both refer to same object.(since both refer to same object obviously content is same right. so by default in case of String if == is true then .equals() always true right??
Does this behaviour change with StringBuilder, Custom Object, string Buffer etc