When an object is out of reference, the system verifies that its finalize () is called to clean up its resources and verifies that it will become dead. The system verifies that the memory occupied by the object is reclaimed.ProgramIt is completely transparent. The program can only control an object to verify that it is no longer referenced by any referenced variable, and never control when it is recycled.
The program cannot accurately control the timing of Java garbage collection, but we can still force the system to do garbage collection-only this kind of Force notifies the system to do garbage collection, but the system is still not sure whether to do garbage collection. There are two methods to force garbage collection:
1. Call the GC () static method of the system class: system. GC ();
2. Call the GC () instance method of the runtime object: runtime. getruntime (). GC ()
Three State Transformations of an object: