Answer Posted / ashwani maddeshiya
static void gc() // Requests GC to run
static void runFinalization() // Requests finalizers to run
OR
mport java.util.*;
class GarbageCollectionDemo
{
public static void main(String s[]) throws Exception
{
// Get runtime environment
Runtime rt = Runtime.getRuntime();
System.out.println("Free memory before Garbage Collection = "+rt.freeMemory());
// Apply garbage collection
rt.gc();
System.out.println("Free memory after Garbage Collection = "+rt.freeMemory());
}
}
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is better- service oriented or batch oriented solutions?
why java does not support unsigned keyword?
What is the independent variable in an experiment?
Why Java doesn’t support multiple inheritance?
What is bifunction in java?
How to reverse a string in java?
Is there any difference between synchronized methods and synchronized statements?
Is age a discrete variable?
What is a flag value?
Explain about fail safe iterators in java?
What is the basic difference between string and stringbuffer object?
Is null a keyword in java?
What is __ init __ functions?
What is the base class of all classes?
What is the function of http?