Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class TryCatchCatch {
- public static void main(String[] args) throws ArithmeticException, IndexOutOfBoundsException{
- int num=13, denom=0,result;
- int [] array = {22,33,44};
- try
- {
- result= num/denom;
- result= array[num];
- }
- catch (ArithmeticException error)
- {
- System.out.println("Arithmetic Error");
- }
- catch (IndexOutOfBoundsException error)
- {
- System.out.println("Index Error");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement