Originally posted by Roopesh Gulecha:
I wonder why these two strings are not the same or is there something else to it?
There is something else to it. In this example you are creating two objects with the same content, but omitting the step of assigning an object reference to each one.
You could write it this way:
and achieve the same result. The compiler cannot assume a and b should reference the same object in memory just because
at this moment their content value is the same.