Important Java Mcq 1

What is garbage collection in the context of java?

a. The operating system periodically deletes all of the java files available on the system

b. When all the references to an object are gone, the memory used by the object is automatically reclaim.

c. Any package imported into a program and not used is automatically delete.

d. None of the above.

Answer:

b. When all the references to an object are gone, the memory used by the object is Automatically reclaim.

Explanation:

Garbage collector is a form of memory management that checks the memory from time to time and marks the variables or objects not used by the program, automatically. After repeatedly identifying the same variable or object, the garbage collector confirms that the variable or object is not used and hence can be deleted.

Related MCQs
Aniket Malik

Aniket Malik

CERTIFIED TUTOR/TRAINER WITH 300+ REVIEWS

Facing difficulty with

this concept?