demo3.java
19 linesjava
DOWNLOAD
1// Aim: Program to perform Exception Handling.
2public class demo3{
3    public static void main(String[] args){
4        try{
5            int a[] = new int[5];
6            a[5] = 30/5;
7        }
8        catch(ArithmeticException e){
9            System.out.println("Arithmetic Exception occurs");
10        }
11        catch(ArrayIndexOutOfBoundsException e){
12            System.out.println("ArrayIndexOutOfBounds Exception occurs");
13        }
14        catch(Exception e){
15            System.out.println("Parent Exception occurs");
16        }
17        System.out.println("rest of the code");
18    }
19}