Intermediate Java
Q66 / 100

What happens when you catch a parent exception type before a child type?

Correct! Well done.

Incorrect.

The correct answer is B) A compile-time error occurs because the child catch is unreachable

B

Correct Answer

A compile-time error occurs because the child catch is unreachable

Explanation

Java requires more specific exceptions to be caught before broader ones. Placing a parent type first makes child-type catch blocks unreachable, which is a compile-time error.

Progress
66/100