Answer:

Yes.

Before and After

Here are pictures of the action. The picture on the left shows the program just as it starts to run. No objects have been created yet, but the reference variable exists. The slash through the variable means that it does not yet refer to an object. Then the assignment statement executes:

str = new String( "Elementary, my dear Watson!" );

This creates an object and puts a reference in str. This is shown on the right. The reference is shown as an arrow that leads to the object, and this is a good way to think of it. (Although in reality it is just a bit pattern, like everything else in computer memory.)

object creation

The variable will continue to hold the reference to the object until some other assignment statement changes it or the program ends.

QUESTION 7:

The object now exists. Can we run its methods?