Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

finalize()

 
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
  • Quote
  • Report post to moderator
YES or NO
 
Doit
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • 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.
 
To do a great right, do a little wrong - shakepeare. twisted little ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic