Hey, I am not able to follow the Concept of garbaghe collection and How to enforce it in a program. Can anyone help me with this and any resources or links regardiong this will be of great help. thaanks So much Gowri
You cannot enforce garbage collection. But you can request the system to do that by calling System.gc(). Garbage colector is a low priority thread running asynchronously to your program exacution threads. It detects unreachable objects, mark them ,invoke it's finalize (if overridden ), and frees memory all in the background with no specific time bound. You cannot specify the exact time of garbage collection.