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
Java stores all Strings in a string table internally during a run. The references to the two strings are identical because in memory they're stored in the same place. Hence, Equal.
Your statement is right, that == compares object references. Try the same thing with any other class but Strings and you won't get the same result.