AP® Computer Science A glossary
Object reference
Also called: reference, object address
Course: AP® Computer Science A Shows up in: Unit 1: Using Objects and Methods
The value a reference variable holds: it can be thought of as the memory address of the object.
Appears in the course and exam description (CED): 1.12.B.11.13.B.1
Assigning one reference variable to another copies the reference, not the object, so both refer to the same object.
Plant a = new Plant("Basil", 10);
Plant b = a;
b.grow(5);
System.out.println(a.getHeight());
Output:
15 Learn it properly, with a checkpoint 1.12 Objects: Instances of Classes