Hi, This is more another doubt than a solution. Can't you call finalize() on the object you want to destroy?
As finalize is already a method in the class Object it must be accesible for every other object even if it's overwritten. So for this particular problem we could do: myObject.finalize(); count--; Or is this method only accessible for the garbage collector? Anyway, the java way of doing this I think would be making sure there are no active references to the object to destroy, decrease the count and let the the garbage collector work Pablo. 2008/9/4 miga <[EMAIL PROTECTED]> > > > > On Sep 4, 9:12 am, han <[EMAIL PROTECTED]> wrote: > > How about my scenario? > > It is not a good java code practice,isn't it? > > How can I destroy a object explicitly? > You may nullify it. See here for details: > <http://java.sun.com/developer/JDCTechTips/2003/tt0408.html> > > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/javaprogrammingwithpassion?hl=en -~----------~----~----~----~------~----~------~--~---
