You can find Multiple Catch Blocks in Java Example Program.The concept of Exception Handling multiple catch blocks.
public class MultipleCatchDemo {
public static void main(String args[]) {
try {
int num1 = 24;
int num2 = 0;
System.out.println(“\nIn try block trying to devide…”);
int result = num1 / num2;
System.out.println(“\n\nResult of division: ” + result);
} catch(ArithmeticException e1) {
System.out.println(e1);
} catch(Exception e){
System.out.println(“\n\nException: ” + e);
}
finally {
System.out.println(“\n\nIn the finally block…”);
}
System.out.println(“\n\n”);
}
}
Result:
In try block trying to devide…
java.lang.ArithmeticException: / by zero
In the finally block…