Special Offer take any 4 courses for INR 21999.00*

Courses
0

Can a method have multiple catch blocks?

January 16, 2025

Yes, a method can have multiple catch blocks to handle different exception types.
try {
int[] arr = new int[2];
arr[5] = 10;
} catch (ArrayIndexOutOfBoundsException e) {
System.out.println(“Index out of bounds!”);
} catch (Exception e) {
System.out.println(“Generic exception caught.”);
}

Leave a Comment

Drop a Query

Whether to upskill or for any other query, please drop us a line and we'll be happy to get back to you.

Drop a Query NEW

Request A Call Back

Please leave us your contact details and our team will call you back.

Request A Call Back

By tapping Submit, you agree to Cambridge infotech Privacy Policy and Terms & Conditions

Enquiry Now

Enquiry popup