- Object variable holds a reference
Greeter worldGreeter = new Greeter("World");
An object reference describes the location in JVM memory of an object
and is used to uniquely identify an object:
- Can have multiple references
to the same object
Greeter anotherGreeter = worldGreeter;

-
Any operation executed on any variable referencing the same object affects
the object itself.
Assume a method setName(String newName) that
changes the name Greeter instance variable.
Executing this:
anotherGreeter.setName("Dave");
// now worldGreeter.sayHello() returns "Hello, Dave!"
changes the object referred by both worldGreeter and
anotherGreeter.