Guest User

Untitled

a guest
Nov 16th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.54 KB | None | 0 0
  1. public class Multi_Catch {
  2.     public static void main(String[] args){
  3.     try{
  4.         int x=0;
  5.         int y=50/x;
  6.         int a[] = new int[args.length];
  7.         for(int i = 0; i<=args.length;i++){
  8.            
  9.             a[i] = Integer.parseInt(args[i]);
  10.             }
  11.  
  12.         }
  13.         catch(ArithmeticException e)
  14.         {
  15.         System.out.println("Divide By Zero");
  16.         try
  17.         {
  18.         System.out.println(a[9]);
  19.         }
  20.         catch(ArrayIndexOutOfBoundsException e1)
  21.         {
  22.         System.out.println("array out of bound");
  23.         }
  24.         }
  25.         catch(Exception e)
  26.         {
  27.         System.out.println("Exception");
  28.         }
  29.  
  30. }
  31. }
Add Comment
Please, Sign In to add comment