How about my scenario?
It is not a good java code practice,isn't it?
How can I destroy a object explicitly?

BR
Chen Han

On Sep 4, 2:39 pm, ewer <[EMAIL PROTECTED]> wrote:
> Hi,
>
> On 4 Sep., 05:51, "CHEN HAN A" <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I have experience for c++, but I con't find deconstruction function in
> > java.
> > i know java's garbage collection.
>
> > But consider this scenario:
> > I use class variable "count" to count the number of object and "count++"
> > in constructor.
> > When a object have to be destory, "count--" have to be execute.
> > How can i do?
>
> Have a look at the finalize method 
> inhttp://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html,
> which you can overwrite.
>
> But when the method is called, depends on the garbage collector. When
> the garbage collector
> run's, it detects unreferenced objects and destroys them. When this
> occurs is not fixed.
>
> HTH
> Ewald

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to