

Garbage Collections - Programming
Q1: What allows the programmer to destroy an object x?A x.delete()
B x.finalize()
C Runtime.getRuntime().gc()
D Only the garbage collection system can destroy an object.
ANS:D - Only the garbage collection system can destroy an object.
Option D is correct. When an object is no longer referenced, it may be reclaimed by the garbage collector. If an object declares a finalizer, the finalizer is executed before the object is reclaimed to give the object a last chance to clean up resources that would not otherwise be released. When a class is no longer needed, it may be unloaded.
Option A is wrong. I found 4 delete() methods in all of the Java class structure. They are:
|


For help Students Orientation
Mcqs Questions
One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.