• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

finalize method

 
Shanky Sohar
Ranch Hand
Posts: 1051
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can we call the finalize method for garbage collection explicitly,.....................
 
Henry Wong
author
Marshal
Pie
Posts: 21493
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
 
Hebert Coelho
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is like the SCJP book says... "The finalize() methods just suggest that those objects should be collect."

 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic