go to previous page   go to home page  

Answer:

Part A: Just one object. All four reference variables point to the same object. (Optimization creates just one object if the characters are the same.)

(In a sensible program, those four declarations might have been spread out over many lines.)

Part B: Four new objects, each containing the same characters. Think of them as Xerox copies. Four distinct objects that look the same.

(The next chapter discusses this further, in case you are a little unhappy about these answers.)


End of the Chapter

You may wish to review the following. Click on a subject that interests you to go to where it was discussed.

The next chapter discusses object references.


go to previous page   go to home page