Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


cherry p
gc() method
1 Answer(s)      3 years and a month ago
Posted in : Java Interview Questions


what is difference between java.lang.System class gc() method and java.lang.Runtime class gc() method


Advertisement
View Answers

August 17, 2011 at 12:49 PM


Both the methods do the same thing i.e, runs the garbage collector. But there are some differences:

1)System.gc() is a class method where as Runtime.gc() is an instance method.

2) System.gc() method is static so more conveninent to use in comparison to gc() method of Runtime class (Runtime.getRuntime().gc()).



Related Tutorials/Questions & Answers:
 

 

 

DMCA.com