Strings are immunable – What does this mean?
When I change a
String with a string operation like
replace or StringBuffer then the changed String is
a new string object / reference
In this case s2 has the same content as s1 after a string
Operation. But s2 is not pointing to the same reference
(memory place) than s1 as s2==s3 is not true.
String s2 = s1.replace('m','r');
The line above s1.replace('m','r') return's a String object...
it is same as creating String s2 = new String("amit");
When you give (s2==s3) the answer is false, because they r
referring to different memory locations..