S
Stofdeel
Hello,
my java book states that finalize is not a deconstructor. Further more it
states that you can not depend on finalize to be called. And there is no
such thing as a deconstructor in java.
I have to decrease a counter whenever an object is destroyed. I would like
to do this in the deconstructor. Calling a method to do this is kinda risky
because big change someone will forget.
Is there a way to make sure finalize is always called? Any other method for
ensuring certain code is run when an object is destroyed?
What is the reason java does not have a deconstructor like other languages?
Some one said it was so that java can garantue that garbage collection is
always performed correctly but I dont see why that should prevent me
performing some last statements.
Thanks for any info.
my java book states that finalize is not a deconstructor. Further more it
states that you can not depend on finalize to be called. And there is no
such thing as a deconstructor in java.
I have to decrease a counter whenever an object is destroyed. I would like
to do this in the deconstructor. Calling a method to do this is kinda risky
because big change someone will forget.
Is there a way to make sure finalize is always called? Any other method for
ensuring certain code is run when an object is destroyed?
What is the reason java does not have a deconstructor like other languages?
Some one said it was so that java can garantue that garbage collection is
always performed correctly but I dont see why that should prevent me
performing some last statements.
Thanks for any info.