© S. Uchitel, 2004
References to Objects
What is a reference to an object?
The position in memory where the object is stored in the heap
What is a reference for?
Think of it as what a remote control is to a TV.
Direct interaction with an object is impossible.
Interaction is always through a reference to the object.
What do we do with a reference returned by new?
Store it in a reference variable
myCar = new Car(“Red”, “Fiat 600”, “25”);