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 are measurable parameters?
Difference between ‘>>’ and ‘>>>’ operators in java?
Why we used break and continue statement in java?
what invokes a threads run() method? : Java thread
What is sizeof in java?
Is passing by reference faster?
What is the generic function?
How to make a write-only class in java?
design an lru cache in java?
How many tetrahedral voids are there in bcc?
What is java in simple terms?
Is age a discrete variable?
What is JDBC Driver interface?How can you retrieve data from the ResultSet
What is a conditional statement explain with example?
What is indexof?