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

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()).
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.