Total members 11894 |It is currently Thu Nov 21, 2024 11:02 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





finalize() function :
Garbage collectors delete objects when it has no reference pointing to it. Your object can has finalize () function. It is called before destroy of the object. This function is used to free any resource that is in use of the object. Finalize () function is a member Object class. As you should already know any class in java is inherited from object class. You can override the finalize function and specify what your object do before it destroy. There is no guarantee to invoke garbage collectors, hence no guarantee for finalize method to be called. So it is a good programming to free resource when you will not need it again When object has reference it is called unfinalized and when it has no reference is it is called finalizer reachable, because it can be only accessed in the finalize () function.

example :
Code:
protected void finalize() {

// clean up code 
}




_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : finalize() function
 object's finalize() in java     -  
 php function     -  
 Using the array_slice () Function     -  
 Function return more than one value     -  
 Nested function     -  
 function key recognition     -  
 array_key_exists function use     -  
 Using include function     -  
 Function Overloading     -  
 The isset() Function     -  



Topic Tags

Java OOP
cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com