Give the output of the following code in java exception handling?

class ExceptionOutput

{

      public static void main(String arg[])

      {

            try

            {

                  int a[]=new int[5];

                  a[5]=30/0;

            }

            catch(ArithmeticException e)

            {

                  System.out.println("Task 1");

            }

            catch(ArrayIndexOutOfBoundsException e)

            {

                  System.out.println("Task 2");

            }

            catch(NumberFormatException e)

            {

                  System.out.println("Task 3");

            }

            System.out.println("Normal Flow");

      }

}

Give the output of the following code in java exception handling.PNG

, , , , , ,

Leave a Reply