If an object reference is set to null, will the garbage collector immediately free the memory held by that object?



If an object reference is set to null, will the garbage collector immediately free the memory held b..

Answer / Narendra Kumar Gupta

No, setting an object reference to null does not immediately free the memory. The garbage collector only reclaims the memory when it determines that there are no more references pointing to the object and the object is no longer reachable.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

What will happen when using pass by reference in java?

1 Answers   HCL,


What is valid keyword in java?

1 Answers  


How can we find size of the object ?

5 Answers   CTS, RazorSight,


Why are functions called methods in java?

1 Answers  


What is broken and continue statement?

1 Answers  


what happens when we add the objects morethan the size limit to a hashmap

1 Answers  


What is anagram of a string?

1 Answers  


whats is the use of final,in which situation final can be used in the application?

2 Answers   DNS,


What is the entry point in Java, and how is it written?

2 Answers  


Is there any use of an abstract class which has no methods and no attributes?

1 Answers   Wipro,


What are parsers? Dom vs sax parser.

1 Answers  


What is queue in java?

1 Answers  


Categories