File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Garbage Collector: Default Behavior Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Garbage Collector: Default Behavior" Watch "Garbage Collector: Default Behavior" New topic
Author

Garbage Collector: Default Behavior

Rodney Woodruff
Ranch Hand

Joined: Dec 04, 2001
Posts: 80
If I call finalize() on an object before the garbage collector will the garbage collector still call finalize() on that object? This question stems from the fact that the finalize method will only be called on an object once in its lifetime.
Thanks for all your help.


Hope This Helps
Rob Ross
Bartender

Joined: Jan 07, 2002
Posts: 2205
Yes Rodney, the finalize() method may still be called (once) by the gc even if you manually call it.
*ANY* method you create, you are free to call. You can even call your own main() method.
It's just that some methods are entry points that the VM uses to control your app, and they are well-known, like main() and finalize().


Rob
SCJP 1.4
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Garbage Collector: Default Behavior
 
Similar Threads
Finalize and System.gc()
finalize question
Finalize():will garbage collector call finalize() after my code has already called it?
Garbage Collection
Garbage Collection