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
Why Set interface contains unique elements, what internally implemented for this so that it contains unique elements?
What are java packages?
What are the new features in java 8? Explain
What is the original name of java?
Can you sort a string in java?
why we use merge option in hybernate pls give a ex snippet
Explain the importance of import keyword in java?
Is a method a function?
What is replaceall in java?
What is the meaning of find and replace?
What is bubble sorting in java?
What is a class component?
What are the types of casting?
What is core java used for?
Why are pointers not secure?