GIAC
GSSP-JAVA · Question #30
Mark works as a Programmer for InfoTech Inc. He develops the following code snippet. 1. public class Header 2. { 3. //code// 4. { 5. System.out.println("Print the code."); 6. super.finalize(); 7. }…
The correct answer is C. protected void finalize() throws Throwable. See the full explanation below for the reasoning.
Question
Mark works as a Programmer for InfoTech Inc. He develops the following code snippet. 1. public class Header 2. { 3. //code// 4. { 5. System.out.println("Print the code."); 6. super.finalize(); 7. } 8. } Which of the following header statements should be placed at line 3 to execute the program successfully?
Options
- Avoid finalize() throws Exception
- Bprivate void finalize() throws Exception
- Cprotected void finalize() throws Throwable
- Dvoid finalize() throws Throwable
How the community answered
(18 responses)- B11% (2)
- C83% (15)
- D6% (1)
Community Discussion
No community discussion yet for this question.