我遇到了一个奇怪的场景,当我们初始化一个新对象并且对象计数是 JVM 非常高时,是否有可能 JVM 重新使用已经创建的对象?
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!
是否有可能重复使用实例。?有没有人遇到过这种情况?