As it is stated the == operator compares object references to check if they are referring to the same object on a heap. If so why am I getting the \"Equal\" for this piece o
Comments above have summed it up pretty well.
I don't have a Java environment handy, but attempting the following should clarify things for you (hopefully this works as I anticipate).
String str1 = "Str1"; String str2 = "Str"; str2 += "1";
Should now print Not equal