Results 1 to 6 of 6
Thread: Finalizers method?
- 08-03-2007, 01:47 PM #1
Senior Member
- Join Date
- Jul 2007
- Posts
- 130
- Rep Power
- 0
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?:confused:
Anyone can help me with an example of when and why we use a finalizers method?
Thanks :)
CruxBlack
- 08-03-2007, 01:58 PM #2
Member
- Join Date
- Aug 2007
- Posts
- 47
- Rep Power
- 0
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.
- 08-03-2007, 02:15 PM #3
Senior Member
- Join Date
- Jul 2007
- Posts
- 130
- Rep Power
- 0
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
- 08-03-2007, 03:24 PM #4
Member
- Join Date
- Aug 2007
- Posts
- 47
- Rep Power
- 0
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.
- 08-04-2007, 03:00 AM #5
Senior Member
- Join Date
- Jul 2007
- Posts
- 130
- Rep Power
- 0
Oh, well, that kinda brief me in more, thanks henry :)
- 08-04-2007, 01:56 PM #6
Member
- Join Date
- Aug 2007
- Posts
- 6
- Rep Power
- 0
Similar Threads
-
method not abstract, does not override actionperformed method.
By Theman in forum New To JavaReplies: 2Last Post: 03-26-2010, 05:12 PM -
Method Help
By pringle in forum New To JavaReplies: 4Last Post: 04-16-2008, 01:23 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks