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 finalize method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "finalize method" Watch "finalize method" New topic
Author

finalize method

Shanky Sohar
Ranch Hand

Joined: Mar 17, 2010
Posts: 1051

can we call the finalize method for garbage collection explicitly,.....................


SCJP6.0,My blog Ranchers from Delhi
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18108
    
  39


You can call the finalize() method, as you can call any method that you have access to -- so if you have access rights, you can call it.

Now... calling the finalize() method doesn't trigger a GC. Calling the finalize() method only causes ... well... the finalize() method to be called.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

It is like the SCJP book says... "The finalize() methods just suggest that those objects should be collect."



[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6657
    
    5

phil sohar wrote:can we call the finalize method for garbage collection explicitly,.....................


Nope. It is a callback method, meaning you dont call it, the JVM does.


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: finalize method
 
Similar Threads
why finalize() can't be defined as private?
Gc question
Finalization Method
finalize
difference between finally and finalize()