How is Garbage collection done in Java?
Answer Posted / harish
Garbage Collection is carried out based on the reference
type an object is currently in.
There are 4 types of references in java
1)strong reference
2)soft reference
3)weak reference
4)phantom reference
the last one is the weakest of the weak.
JVM will try get all those of object that are fell in this
category and try to collect it.
But it is not neccessary the object in phantom reference
phase will always be garbage collected.
Is This Answer Correct ? | 4 Yes | 3 No |
Post New Answer View All Answers
What is string substring?
What is static import?
What is wrapper class html?
Define an abstract class with reference to java.
What is int lol?
Can we overload the methods by making them static?
Explain the differences between abstraction and encapsulation?
Can a main method be overloaded?
What is the use of parse function in java?
What is Major and importance difference between for and foreach loop ?
When is the finalize() called? What is the purpose of finalization?
What type of language is java?
Can we override the static method?
What is the difference between int and integer in java?
Can we serialize arraylist in java?