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
How do you achieve polymorphism in java?
What is a vararg?
What is the difference between static and global variables and also define what are volatile variables?
Can we compare two strings in java?
What are the important features of Java 8 release?
Describe 2 different ways to concatenate two strings.
What is style and indentation?
Which is better list or arraylist in java?
What is a java string?
What is a singleton class in Java?
What mechanism does java use for memory management?
How to create packages in java?
What is method in java with example?
What is the difference between assignment and initialization?
explain autoboxing in java?