Exactly the same as the first version of it:
First values: java.awt.Point[x=12,y=45] Final values: java.awt.Point[x=-13,y=49]
You can not be sure about the internal workings of a program by inspecting its output!
You might want to review the two programs to be sure that you understand their differences:
Program: | What it did: |
---|---|
The first program | An object was constructed. The variable pt refers it. Then, new data replaced the old data inside the same object. |
The second program | An object was constructed. The variable pt refers it. Then, a new object was constructed with new data, and pt was changed to refer to the new object. The first object became garbage. |