JVM to Run Garbage Collector Example
Chapter:
Run Time
Last Updated:
17-06-2016 08:46:59 UTC
Program:
/* ............... START ............... */
public class JavaGarbageCollectorExample {
public static void main(String args[]) {
Runtime runtime = Runtime.getRuntime();
runtime.gc();
System.out.println(" object is garbage collected ");
}
}
/* ............... END ............... */
Output
object is garbage collected
Tags
Total Memory Java Virtual Machine (JVM), Java, Runtime