Multiple References to the Same Object
You'll learn: How two or more reference variables can point to the exact same object in memory, sharing access to its state.
The Core Idea
When you assign one reference variable to another, Java doesn't create a copy of the object—it copies the reference (the memory address). Both variables now point to the same single object on the heap. Any change made through one reference affects what you see through the other, because there's only one object.
Think of it like two people holding directions to the same house. They both have different pieces of paper (the references), but they lead to the same physical location. If someone goes to that house and paints the door red, everyone who visits will see the red door—it doesn't matter which set of directions they used.
How It Works
int[] numbers = new int[]{10, 20, 30}; // Create one array object
int[] moreNumbers = numbers; // Copy the reference, not the array
// Now both variables point to the same array in memory
moreNumbers[0] = 99;
System.out.println(numbers[0]); // Prints: 99
System.out.println(moreNumbers[0]); // Prints: 99
Both numbers and moreNumbers reference the same array object. Modifying the array through moreNumbers changes what numbers sees, because there's only one array.
Why This Matters
This behavior explains why passing arrays (or any reference type) to methods allows those methods to modify the original object—they receive a copy of the reference, pointing to the same object on the heap.
Key Takeaway: Multiple reference variables can point to the same object; changes through one reference are visible through all others because they share the same underlying object in memory.