Which method headers will result in a correct implementation of a finalizer for the following class?
public class Main { // (1) INSERT METHOD HEADER HERE ... { System.out.println("Final curtain"); super.finalize(); } }
Select the two correct answers.
finalize()
throws Throwablefinalize()
throws Exceptionfinalize()
finalize()
throws Throwablefinalize()
throws Exceptionfinalize()
finalize()
throws Throwablefinalize()
throws Exceptionfinalize()
finalize()
throws Throwablefinalize()
throws Exceptionfinalize()
(d) and (g)
(a), (b), (c), (j), (k), (l): reduce the visibility of the inherited method.
(e), (f), (h), (i): the call to the finalize()
method of the superclass can throw a Throwable, which is not handled by the method.
The Throwable superclass is not assignable to the Exception subclass.