• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

finalize()

 
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
when extending a class that has a finalize method, you must write a finalize, that executes super.finalize()
Is it must??
- Thanks

[This message has been edited by Doit (edited September 03, 2000).]
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

The finalize() methods are basically used for special purposes for example to take care of any native methods (where JVM does not have any control) whether they are properly cleaned up.When u extend a class that has finalize method, how can u be sure about the native methods used by super class are closed/cleaned up? Only way is using super.fianalize() in extended class. Hope this helps!!
Jaypii
 
Doit
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it must to use super.finalize()
or the same can be acheived the otherway?
- Thanks
 
Doit
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it must to override finalize() method if you are
subclassing a class that has a finalize() method?
Yes
No
- Thanks
 
Doit
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
YES or NO
 
Doit
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
False.
is wrong too because of the use of should qualifier here. Calling super.finalize() and it is highly recommended to
ensure proper finalization of all the objects in the hierarchy. However, it is not a should-have condition. If you are
sure it will not cause any resource eaks you may chose not to do it!
Thanks Ajit for shooting the point. I got the answer from one of the previous post.
 
The glass is neither half full or half empty. It is too big. But this tiny ad is just right:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic