A method catches multiple exceptions using a multi-catch clause. Which statement about the exceptions in a multi-catch clause is correct?
Subclass relationship makes one unreachable, causing compile error.
Why this answer
Option A is correct because Java requires that exception types in a multi-catch clause be disjoint (i.e., not in a subclass/superclass relationship). If one exception is a subclass of another, the code will not compile because the catch block would be unreachable for the subclass exception, violating the rule that catch blocks must be ordered from most specific to most general. This ensures that the multi-catch clause is unambiguous and that each exception type is distinct.
Exam trap
The trap here is that candidates often confuse multi-catch with single-catch ordering rules, assuming that the order of exceptions in a multi-catch clause matters for handling, when in fact the compiler enforces disjointness and order is irrelevant within a single multi-catch block.
How to eliminate wrong answers
Option B is wrong because multi-catch clauses can include both checked and unchecked exceptions, as long as they are disjoint; there is no restriction that they must be unchecked. Option C is wrong because the Java Language Specification does not limit the number of exception types in a multi-catch clause to three; you can list any number of exception types separated by '|', as long as they are disjoint. Option D is wrong because the order of exceptions in a multi-catch clause does not matter for handling; the compiler checks that the types are disjoint, and if they are not, it fails compilation—there is no 'first matching catch' behavior within a single multi-catch block.