What must be the order of catch blocks when catching more than one exception?

What must be the order of catch blocks when catching more than one exception?

When you use multiple catch blocks, it is important to remember that exception subclasses must come before any of their superclasses. This is because a catch statement that uses a superclass will catch exceptions of that type plus any of its subclasses. Thus a subclass would never be reached if it came after its superclass. Further, in Java, unreachable code is an error.

By:Jalees
Date:2015-01-09 00:00:00

Post Your Answers


User Email:

User Name:
Answers:

Related Java Subjective Links

Java Subjective interview questions and answers for experienced and fresher