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 a map? What are the implementations of map?
Write a java program to generate fibonacci series ?
What is byte data type?
How you can force the garbage collection?
What are the various access specifiers for java classes?
How do you allocate memory to object?
How many bits are used to represent unicode, ascii, utf-16, and utf-8 characters in java programming?
can any body body expalin best definitions & best real time exaples for opps concepts.
What do you mean by data type?
How does split work in java?
What’s the difference between the methods sleep() and wait()?
How can we create objects if we make the constructor private ?
What is the difference between a loader and a compiler?
What is the difference between final, finally and finalize() in java?
What is procedure writing?