In basic terms:
You have a lot of objects stored in RAM.
There are 'pointers' which store the position of the object in RAM.
When you call a function, you pass a copy of the pointer to the function, which then finds the object which it points at.
Any changes to the object affect the object, which will change what's being referenced by all pointers, but:
If you reassign the variable, it changes the local value of the pointer, not the value of the object, and not the value of the pointer in other locations.
Here is a workaround to help explain my point:
1 2 3 4 5 6 7 8 9
| class Pointer <T extends Object> { public T value;
public Pointer(T value) { this.value = value; } } |
(Generics aren't neccessary, you can change it to just a certain class if you want)
Then you can change the value and it will change in all locations of the class.
DISCLAIMER: I do not recommend using that workaround. It was just to help explain the problem. Please just redesign your code.