Answer:

First  value of message: Original Object 
First value of parameter: Original Object 
Second value of parameter: Hah! A second Object! 
Second value of message:   Original Object 

Revised Picture

In the revised program, the print() method created a new object and placed a reference to it into the parameter st. As long as you know what you are doing, this is OK.

Each color of line in the picture represents a different reference value. The picture shows the print() method changing the value in the formal parameter so that it refers to a second object.

two objects

Neither the original object, nor the variable message of the main() method are changed. The print() method can use its formal parameter just like any variable, including changing the value it holds.


QUESTION 9:

Could print() use the reference to the original String object to change the contents of that object?