Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-03-2007, 02:47 PM
Senior Member
 
Join Date: Jul 2007
Posts: 130
cruxblack will become famous soon enough
Finalizers method?
What do we use finalizers method for actually?
Ive been reading some literature, and some said that it was to do some house-cleaning process before the garbage collector took over the cleaning work

What i dun understand is, what house cleaning process?
Anyone can help me with an example of when and why we use a finalizers method?

Thanks
CruxBlack
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-03-2007, 02:58 PM
Member
 
Join Date: Aug 2007
Posts: 47
henry_78 is on a distinguished road
Hi,
This method is the one that the garbage collector execute when he desides to eliminate an object from the memory.
Naturally he cant eliminiate an object if it has a reference.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 08-03-2007, 03:15 PM
Senior Member
 
Join Date: Jul 2007
Posts: 130
cruxblack will become famous soon enough
Mmm, correct me if im wrong, but isnt the objects got dump and the memory freed when we do System.exit(0)?
When does the finalizers got called?
And btw, is there any problem tat might require that we override the finalizers methods?
I have seen some examples bout this overridings, but unfortunately, i didn't analyze them further or save the codes, so im still bit confused
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 08-03-2007, 04:24 PM
Member
 
Join Date: Aug 2007
Posts: 47
henry_78 is on a distinguished road
When u do Systm.exit(0) u terminate the whole virtual machine.
the system.exit(n) --> calls another method in the class System.exit(n) method.
The Runtime.exit(n) method when it is closing the vitual machine , one of its operations is to call all the uninvocaed finalize() methods.
The finalize method free the memory of an object (make it available to be reused).
From my point of view i think u will need to overwrite this method very rarely...only in some precise situations..Bye.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 08-04-2007, 04:00 AM
Senior Member
 
Join Date: Jul 2007
Posts: 130
cruxblack will become famous soon enough
Oh, well, that kinda brief me in more, thanks henry
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 08-04-2007, 02:56 PM
Member
 
Join Date: Aug 2007
Posts: 6
palindrome is on a distinguished road
The garbage collector removes an object from memory when they are no more references to it - i.e. nothing is using it any more. If this didn't happen, you'd just keep using more and more memory as your program ran.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Method Help pringle New To Java 4 04-16-2008 02:23 PM
method not abstract, does not override actionperformed method. Theman New To Java 1 05-08-2007 07:13 AM


All times are GMT +3. The time now is 02:02 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org