This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes gc() method 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 » Java » Java in General
Bookmark "gc() method" Watch "gc() method" New topic

gc() method

jose chiramal
Ranch Hand

Joined: Feb 12, 2010
Posts: 266
Why do we have the gc() method in both the System class and the Runtime class. Is there any specific reason ?
David Newton

Joined: Sep 29, 2008
Posts: 12617

As the documentation states, System.gc() basically calls the Runtime method. I'd assume convenience.
It is sorta covered in the JavaRanch Style Guide.
subject: gc() method
Similar Threads
Head First Java Be the Garbage Collector
why two gc() method ?
finalize access specifiers protected/private/public
System vs Runtime
Runtime.getRuntime().gc() ?