How can you force garbage collection in java?

How can you force garbage collection in java?

You can not force the JVM for the garbage collection. However you can call the System.gc() method in your program to tell the JVM that it may the time to perform garbage collection. But it is upto the JVM that if will call the  System.gc() method or not. There is no way to force the JVM, it works fine without programmer\'s intervention.

By:Jalees
Date:2015-01-09 00:00:00

Post Your Answers


User Email:

User Name:
Answers:

Related Java Subjective Links

Java Subjective interview questions and answers for experienced and fresher