Article View: aus.computers.java
Article #440Re: How to cleanup when a class is destroyed ?
From: DavidL
Date: Fri, 13 Oct 2000 00:00
Date: Fri, 13 Oct 2000 00:00
64 lines
2611 bytes
2611 bytes
Thanks Ross.
I probably need to be more precise with my questions, so they can't be
confused.
I am aware of the finalize method, but, unfortunately, haven't seen it work.
If I have a simple class like:
class class1
{
protected void finalize ()
{
System.out.println ("finalize called");
}
}
and I instantiate an instance of this class in a simple command line app
like:
class app
{
static void main (String args[])
{
class1 c = new class1 ();
}
}
then when that app runs I would expect the "finalize called" message to be
displayed, but it doesn't happen.
Maybe my JVM is broken ?
"Ross Vumbaca" <rossv@au.net.fl> wrote in message
news:39E708EC.4C33B23D@au.net.fl...
> Hi,
>
> DavidL wrote:
>
> > But what if I have a class something like:
>
> <Snip>
>
> People keep confusing your request with garbage collection, which Java
> does. There is a "finalize" method for Java objects, which is run when
> an object is trashed. Can't help much else though ;). The other post
> with the javadocs link will help you.
>
> Regards,
>
> Ross..
>
> --
> *TO E-MAIL ME: Reverse the order of the domain name in my e-mail
> address.*
>
> Ross Vumbaca, a 'poor' Uni student at USyd.edu.au
> http://www.fl.net.au/~rossv
>
> Running on an Amiga 3000 (030/25), ECS, 8Mb Fast, 2Mb Chip, HD FDD
> SCSI HDD's (never mind their size), Kickstart 3.1 (40.68), OS 3.5,
> Linux 2.0 (RedHat 5.1), C= A2065 and an Opalvision card
> - ("Designed in Australia", and keeping the Zorro bus populated).
> --
Technical Details
Message-ID:
<39e78916$1@server.local>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<39e57bc3$1@server.local> <%rnF5.41125$td5.6548300@news1.rdc2.pa.home.com> <39e62821$1@server.local> <39E708EC.4C33B23D@au.net.fl>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10d6db,d25b87a070be9251 X-Google-Attributes: gid10d6db,public From: "DavidL" <email.address@in.message> Subject: Re: How to cleanup when a class is destroyed ? Date: 2000/10/13 Message-ID: <39e78916$1@server.local> X-Deja-AN: 681169840 References: <39e57bc3$1@server.local> <%rnF5.41125$td5.6548300@news1.rdc2.pa.home.com> <39e62821$1@server.local> <39E708EC.4C33B23D@au.net.fl> X-Original-NNTP-Posting-Host: 192.168.0.5 X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-Complaints-To: news@bigpond.net.au X-Trace: news-server.bigpond.net.au 971475599 144.132.179.174 (Sat, 14 Oct 2000 09:19:59 EST) X-Authenticated-User: davidl Organization: BigPond Internet Services (http://www.bigpond.net.au) X-Original-Trace: 14 Oct 2000 09:13:42 +1100, 192.168.0.5 X-MSMail-Priority: Normal NNTP-Posting-Date: Sat, 14 Oct 2000 09:19:59 EST Newsgroups: aus.computers.java