What allows the programmer to destroy an object x?
| ||||||||
Answer: Option D
Explanation:
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:
None of these destroy the object to which they belong.
Option B is wrong. I found 19 finalize() methods. The most interesting, from this questions point of view, was the finalize() method in class java.lang.Objectwhich is called by the garbage collector on an object when garbage collection determines that there are no more references to the object. This method does not destroy the object to which it belongs.
Option C is wrong. But it is interesting. The Runtime class has many methods, two of which are:
|
18 Ekim 2014 Cumartesi
Garbage Collector
Kaydol:
Kayıt Yorumları (Atom)
Hiç yorum yok:
Yorum Gönder