When you assigned "hi" to string1, what happened is that the variable string1 got assigned a new reference to an object on the heap which contains the text "hi".
Whereas, the variablestring2is still holding a reference of the object which has text"hello"within it.