This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
we cannot directly say when the garbage collector will destroy the objects
when a running thread using that object is dead, then only there is a possibility that the objects gets destroyed
and also when the objects are null referenced then they can be destroyed
we can call the gc() method but it is merely a request and not the command
SCJP 6 [86%], OCPWCD [84%], OCEJPAD [83%]
If you find any post useful, click the "plus one" sign on the right
The Object will not get marked for the collection by the GC as long as its reference exists. In case of static it will be loaded till the thread running it is alive. To make it eligible for GC you can call a method which can set the reference to null.