I am trying to keep a temporary container of a class that contains member :
HashMap myobjectHashMap
A class called my
In Java, when you write:
Object objectA = new Object();
Object objectB = objectA;
objectA and objectB are the same and point to the same reference. Changing one will change the other. So if you change the state of objectA (not its reference) objectB will reflect that change too.
However, if you write:
objectA = new Object()
Then objectB is still pointing to the first object you created (original objectA) while objectA is now pointing to a new Object.