public class TestgarbageCollector extends java.lang.Object
|Constructor and Description|
|Modifier and Type||Method and Description|
This method calls the method
public void testNewInstance()
createAndReturnInstance()to create an instance, which is not stored in the class. The reference is known only in a stack variable. The reference is used. The garbage collector should not attack this instance. To force working of garbage collection, a Thread.sleep() is built in this method.