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

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

Mastering Java: The Ultimate Quiz for 'Thinking in Java'. Dive deep into Java with multiple-choice questions. Challenge yourself with quiz questions designed to test and improve your understanding of the 'Thinking in Java' book. Get ready for your exam!

Practice this question and more.


Which statement about unchecked exceptions is true?

  1. They're a direct subclass of Exception

  2. They must be caught or declared to be thrown

  3. They are checked at compile time

  4. They inherit from RuntimeException

The correct answer is: They inherit from RuntimeException

RuntimeException is a subclass of Exception that inherits from RuntimeException, and unchecked exceptions are all subclasses of RuntimeException. This means that unlike checked exceptions, which must be caught or declared to be thrown, unchecked exceptions are not required to be handled by code, making option D the most accurate choice. All the other options are incorrect as they either make general statements about checked/unchecked exceptions that do not apply specifically to unchecked exceptions, or they are incorrect statements about the classification of exceptions.