//Program to explain that, when we use multiple catch statements, it is
//important to remember that exception subclasses must come before any of their superclasses.class MultipleException
{
public static void main(String args[ ])
{
try
{
int a = 0;
int b = 10 / a;
}
catch(Exception e)
{
System.out.println("Generic Exception catch.");
}
catch(ArithmeticException e)
{ // ERROR – unreachable code
System.out.println("This is never reached.");
}
}
}
Output:MultipleException.java|34| error| exception ArithmeticException has already caugh
catch(ArithmeticException e)
error