The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
April 2000


where you can ask and answer Java programming questions."> - a resource for Java and Jini developers
Artima | Search | Java | Design | JVM | Jini | Books | Seminars | Subscribe 

Java Answers Forum
April 2000

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


finalize() method call unpredictable???

Posted by Padma on April 19, 2000 at 4:37 PM


I am learning java and find your book Thinking in Java (TIJ2.pdf) really good.

There was one problem that I faced while executing one of the e.g. the code for This compiled w/o any problem. When I executed it the first time with a command line parameter of "finalize", I got the o/p as specified in the book. But on subsequent executions, after the Frog, Amphibian and Animal finalize, the program terminated!

I didn't see these messages:

LivingCreature finalize
finalizing Characteristic is alive
finalizing Characteristic has heart
finalizing Characteristic can live in water

Is it because Garbage Collection is not predictable? Maybe I need to review my concepts, but any light in this direction is most certainly appreciated!


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us