How is Garbage collection done in Java?
Answers were Sorted based on User's Feedback
Answer / sandeep
Garbage Collection is a complex feature in Java Technology.
By Programme we cannot cause gc but we can request JVM using
gc() method but it does not gurantee. Actually when an
object in our programme become unreachable it is ready to
garbage collection..the garbage collection runs periodically
and then claim the memory it does occupy ( the unreachable
object)..and is how garbage collected is done.
| Is This Answer Correct ? | 17 Yes | 2 No |
Answer / boomiraj
Programmer can not cause the garbage collector.
We can call the garbage collection using System.gc();
And we can set the variable value equal to null, it assign that variable garbage rest the that use.
| Is This Answer Correct ? | 3 Yes | 1 No |
Answer / 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 |
Difference between abtsract & final
How to sort a collection of custom Objects in Java?
What is bitwise complement?
Explain the key functions of data binding?
0 Answers Akamai Technologies, Aspire, Impetus, Infogain, Tavant Technologies, Virtusa,
What is the use of inner class?
Why Java is not pure Object Oriented language?
I have multiple constructors defined in a class. Is it possible to call a constructor from another constructor’s body?
What is dynamic binding?
Tell me the latest versions in java related areas?
What is the += operator called?
What is the epoch date?
What are some characteristics of interference class?