Can an object be garbage collected while it is still
reachable?

Answer Posted / sudheer

Garbage collector is a low priority thread. We cant order to delete an object. When the object has no references and object which are out of scope will be deleted by the garbage collector to free the memory. So when an object is reachable it cant be garbage collected.

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can keyword be used as identifier?

641


What is use of static in java?

642


What is time complexity java?

626


What is the concatenation operator in java?

687


What are static methods?

668






How does a for loop work java?

645


What is mean by exception?

642


How do you clear a method in java?

619


Is a method a function?

654


Difference between object instantiation and construction ?

684


How do you format in java?

650


Difference between notify() method and notifyall() method in java?

643


What are the practical benefits, if any, of importing a specific class rather than an entire package (e.g. Import java.net.* Versus import java.net.socket)?

711


Can we instantiate interface in java?

778


Why singleton class is used in java?

666