srikanth prasad wrote:When will an object of a class will perish?
Define what you mean by "perish". That is not part of the standard
Java lexicon.
If you mean "reclaim its memory," there's no way to force that in Java.
If you mean "make it so that its memory
can be reclaimed, so that, as far as my program can tell, the object can no longer be used and its memory is, for all intents and purposes, available," then the answer is to ensure that there are no reachable references to it.
If you mean something else, please clarify.