Write a program to show How Exception Handling is in Java

Write a program to show How Exception Handling is in Java

class example {
            public static void main(String arg[]){
                        int d,a;
                        try {
                                    d=0;
                                    a=9/d;
                                    System.out.print("This is exception");
                        }                      
                        catch (ArithmeticException e)
                        {
                                    System.out.print("Division by zero");
                        }
            }
             }


Post a Comment