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

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

Prepare for your Java exam with our ultimate quiz based on 'Thinking in Java'. Engage with expertly crafted questions that enhance your learning process. Perfect for Java enthusiasts looking to solidify their knowledge!

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.


What happens to an exception thrown in a finally block?

  1. It must be caught within the same finally block

  2. It can cause previously thrown exceptions to be lost

  3. It is ignored by the Java runtime

  4. It automatically gets rethrown after the finally block completes

The correct answer is: It can cause previously thrown exceptions to be lost

When an exception occurs within a finally block, it can cause previously thrown exceptions to be lost. This is because the finally block will handle and use up the exception, preventing it from being caught or propagated to the outer scope. The other options are incorrect because A is not true, as exceptions can be caught outside of the finally block; C is not true, as the Java runtime will handle and display the exception if it is not caught in the finally block; and D is not true, as the exception is only rethrown if it is unhandled by the finally block.