JAVA
java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
public class Exception
{
public static void main(String[] args) {
try{
int [] array = new int[4];
array[8] = 40/0;
System.out.println("1");
}
catch(ArrayIndexOutOfBoundsException e) {
System.out.println("2");
}
catch(ArithmeticException e){
System.out.println ("3");
}
finally {
System.out.println("4");
}
}
}
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run