touque.ca > Education Commons > Java > Resources

Object References

A variable of an object type holds a reference (or “pointer”) to an object. Assignments and parameter passing have reference semantics (i.e., the reference, not the object, is copied). After assigning one object variable to another, both variables refer to the same object. The two variables are said to be aliases of the same object. This rule applies in the simple assignment of one variable to another and also when passing an object as an actual parameter to a method. As a consequence, state changes to an object via a formal parameter will persist, after the method has completed, in the actual parameter (Barnes & Kölling, 2012, pp. 504–505).


Barnes, D. & Kölling M. (2012). Objects first with Java: A practical introduction using BlueJ. Toronto: Pearson Education, Inc. ISBN 978-0-13-249266-9.

touque.ca > Education Commons > Java > Resources

[This page last updated 2020-12-23 at 12h13 Toronto local time.]