i am encountering a weird scenario, Is there a possibility of JVM re-using an already created object when we are initializing a new one and the object count is JVm is very high?
abc a = new abc();
a.setAttribute("aaaa");
.........
a...is no longer being used...and has not yet been garbage collected by the JVM. There are multiple threads creating 5000 instances of class abc..
again, abc a = new abc();
Sysout(a.getAttribute()); // This prints "aaaa" set for an earlier instance!
Is there a possibility of an instance being re-used.? Has anyone come across this scenario before?