1.

Which operator is used by Java run time implementations to free the memory of an object when it is no longer needed?(a) delete(b) free(c) new(d) none of the mentionedI got this question in semester exam.My question is based upon Constructors & Garbage Collection topic in portion Classes and Methods of Java

Answer»

Correct choice is (d) none of the mentioned

Explanation: Java handles DEALLOCATION of memory automatically, we do not need to explicitly delete an element. Garbage collection only OCCURS during execution of the program. When no references to the object exist, that object is ASSUMED to be no longer needed, and the memory occupied by the object can be reclaimed.



Discussion

No Comment Found

Related InterviewSolutions