Write a program in java to demonstrate Exception Handling?

class ExceptionHandling

{

      public static void main(String arg[])

      {

            int a=Integer.parseInt(arg[0]);

            int b=Integer.parseInt(arg[1]);

            try

            {

                  System.out.println(a/b);

            }

            catch(ArithmeticException e)

            {

                  System.out.println(e);

            }

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

      }

}

Exception Handling.PNG

 

 

, , , , , , ,

Leave a Reply