JVM garbage collector
In this chapter you will learn:
Run garbage collector and finalization methods
void gc()
Runs the garbage collector.void runFinalization()
Runs the finalization methods of any objects pending finalization.
public class Main {
public static void main(String[] args) {
Runtime runtime = Runtime.getRuntime();
//j ava 2 s .co m
runtime.gc();
runtime.runFinalization();
}
}
Next chapter...
What you will learn in the next chapter:
Home » Java Tutorial » Utility Classes