D4.5 – D4.6 – Object References

Define the term object reference

Object reference is the variable that holds the memory location of the real object

In Java all objects are referred to by references for instance

Object person = “Mr Godbold”;

The above example has a reference, person, to the object “Mr Godbold”.

An Object is an instance of a Class, it is stored some where in memory

A reference is what is used to describe the pointer to the memory location where the Object resides.

A variable is a means by which you can access that memory location within your application (its value is “variable”). While a variable can only point to a single memory address (if its not null), it may change and point to different locations through out the life cycle of the application