share

Saturday, 7 February 2015

How To Exception Interrupt Program In java


In this  program exception occur during  the execution ,statement i/j. Normal execution of this program interrupt and program goes terminate.

public class simple_example {

        public static void main(String[] args) {
      int i=10;
      int j=0;
      System.out.println("i/j="+i/j);
       }
}

Output:

Exception in thread "main" java.lang.ArithmeticException: / by zero
at exception_handling.simple_example.main(simple_example.java:8)

No comments:

Post a Comment