Multiple choice technology programming languages

Is a program required to catch all exceptions that might happen?

  1. No. You can write a program to catch just the exceptions you want.

  2. No. But if a program catches one type of exception it must catch all other types as well.

  3. Yes. If a program is not written to catch all exceptions it will not compile.

  4. Yes. A program can not do I/O unless it catches all exceptions.

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Java only requires catching checked exceptions. Runtime exceptions (RuntimeException and its subclasses) can be caught or ignored. A program can selectively catch only the exceptions it wants to handle.