What is garbage collection in Java, and how can it be used ?
Answer Posted / rahulmishra642
1>Garbage collection is a deamon thread which runs at the background to support the nin deamon thread.
2>garbage collector is responsible to destroy the useless objects.
3>An obejct is eligible for GC if and only if it doesn;t have any reference.
4>we can also call GC explicitly by System Class and Runtime class
By System Class:
- System.gc();
By Runtime Class
-Runtime r = Runtime.getRuntime(); (here we are creating runtime object by using factory method)
now, you can call gc() method
-r.gc();
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How do you implement tree mirroring in java?
Can you explain the private protected field modifier?
If try block is successfully executed, Then Is Finally block executed?
What are methods and how are they defined?
What are the 4 types of research methods?
What is a methodologist?
Difference between concurrent hashmap and hashtable and collections
List some oops concepts in java?
What is memory leak and how does java handle it?
What is a two-pass assembler?
Which is the class in java?
What do you mean by stack?
What is meant by vector class, dictionary class, hash table class, and property class?
What is the main use of java?
what is the major difference between linkedlist and arraylist in java?