View RSS Feed

My Java Tips

  1. Finalize

    by , 05-24-2011 at 01:46 PM (My Java Tips)
    All Java classes inherits the finalize() method from java.lang.Object and this method is called by the garbage collector when it determines no more references to the object exist.

    The finalize method performs no actions but it may be overridden by any class. It is overridden to clean-up non-Java resources ie closing a file, closing a connection etc. In overridding finalize() it is a good programming practice to use a try-catch-finally statement and to always call super.finalize(). ...
    Tags: finalize Add / Edit Tags
    Categories
    Java SE