What I am trying to understand is class referencing and how that reference changes over the life cycle of a program running. For example
ClassRef ref = new ClassRef();
ref.setVariableOne(1);
ref.setVariableTwo(2);
So I know that this will create an object named ref
which I can pass around in my code to where I need it, I can use serialization to save and load it which is fine. If I were to create some kind of output it would show that ref = 1,2
But what about if I were to do this
ArrayList<ClassRef> refArray = new ArrayList<ClassRef>
refArray.add(ref);
ref.setVariableOne(3);
I have added my object to the array and then changed one of the variables, does the object in the array also update, or does it "save" that as a snap shot at the time it was added, so if I were to output from the array it would give ref = 1,2
or would it show that ref = 3,2