Does java collect the garbage-signed things as objects?
If yes, can i tell java to direct them to one of my hashtables(accepts objects right?) programmatically?
I am curious about this functionality.I know System.gc() is the command but how can i achieve first question? Can i?
myTrashBin=System.gc().getObjectList(); //???
If not, may be there could be a way to create this functionality by custom classes.
Last question: how can we override System.gc() ?
Thanks.
This isn’t under your control. If your objects are unreachable then GC will collect these.
System.gc()is nothing more than a hint, and can’t be relied upon.finalize()may be of interest, but read the answers to this question to understand limitations etc. PhantomReferences may also be of interest.