• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic