public class MyClass {
public static void main(String args[]) {
try {
int[] arr = {1, 2, 3, 4, 5, 6, 7};
arr[19] = 938;
} catch (ArrayIndexOutOfBoundsException | ArithmeticException e) {
System.out.println("Exception: " + e);
}
}
}
/*
run:
Exception: java.lang.ArrayIndexOutOfBoundsException: Index 19 out of bounds for length 7
*/