Advertisement
virtualideaz

TryCatchCatch.java

Mar 26th, 2015
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | None | 0 0
  1. public class TryCatchCatch {
  2.  
  3.     public static void main(String[] args) throws ArithmeticException, IndexOutOfBoundsException{
  4.       int num=13, denom=0,result;
  5.       int [] array = {22,33,44};
  6.      
  7.       try
  8.             {
  9.                 result= num/denom;
  10.                 result= array[num];
  11.             }
  12.       catch (ArithmeticException error)
  13.               {
  14.                   System.out.println("Arithmetic Error");
  15.               }
  16.       catch (IndexOutOfBoundsException error)
  17.               {
  18.                   System.out.println("Index Error");
  19.               }
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement