What happens when an object becomes eligible for garbage collection in Java?

Last Updated :
Discuss
Comments

What happens when an object becomes eligible for garbage collection in Java?

It is immediately deleted from memory

It is marked for garbage collection by the Garbage Collector (GC)


It is still accessible by other threads

It is moved to the Heap space for permanent storage

Share your thoughts in the comments