is try and catch block catching only one exception

Solutions on MaxInterview for is try and catch block catching only one exception by the best coders in the world

showing results for - "is try and catch block catching only one exception"
Gianluca
20 Jan 2017
1class Main {
2  public static void main(String[] args) {
3    try {
4      int array[] = new int[10];
5      array[10] = 30 / 0;
6    } catch (ArithmeticException e) {
7      System.out.println(e.getMessage());
8    } catch (ArrayIndexOutOfBoundsException e) {
9      System.out.println(e.getMessage());
10    } 
11  }
12}
13