diff --git a/exception.java b/exception.java new file mode 100644 index 0000000..61d5830 --- /dev/null +++ b/exception.java @@ -0,0 +1,25 @@ +import java.io.*; +import java.util.*; +class exception{ +public static void main(String args[]) +{ +int a = 10; +int b[] = new int[4]; +try +{ +int c = a/0; +} +catch(ArithmeticException e) +{ +System.out.println("ArthimeticException"+e); +} +try +{ +b[5] = 99; +} +catch(ArrayIndexOutOfBoundsException ae) +{ +System.out.println("An error ocurred :"+ae); +} +} +}