Mastering Java: The Ultimate Quiz for 'Thinking in Java'

Disable ads (and more) with a membership for a one time $2.99 payment

Dive into the depths of Java with our quiz based on "Thinking in Java, Fourth Edition" by Bruce Eckel. Test your knowledge, solidify concepts, and prepare for certification with challenging questions and insightful feedback.

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


Which class will not throw a compilation error if extended by adding a new checked exception to a method signature?

  1. A class that implements an interface

  2. A final class

  3. An abstract class

  4. None, adding a new checked exception is always an error

The correct answer is: An abstract class

Classes that implement an interface (A) will also throw a compilation error due to the need for the method to be implemented. Final classes (B) cannot be extended, so adding a checked exception to their method signature would not be possible. Abstract classes (C) allow for flexibility in method signatures and do not throw compilation errors when a new checked exception is added. Option D states that none of the classes will throw a compilation error, which is incorrect as stated in the question.