Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Why are we able to call finalize() method menually....

807599Nov 21 2006 — edited Nov 21 2006
Hey guys...
I was writing this small java program and learning about finalization........
I tried to call finalize() method manuallly from my public static void main(String[] args) method.....It executed it withiout any error....?
I m coming from C++ background and to the best of my knowledge (Correct me if i m wrong...)....It does not allow us to call destructor manually. So i was wondering why java allows us to call finalize() method manually...
Moreover, If someone calls finalize method manually and at the alter stage when object bcomes gargbage collected, would it be called again by JVM...? I asked this bcos JVM calls finalize() mthod only once on an object...?
U guys rock....
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 19 2006
Added on Nov 21 2006
18 comments
340 views