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)

Leave a Reply

Your email address will not be published. Required fields are marked *

6 + 1 =