Avatar of gudii9
gudii9
Flag for United States of America

asked on 

Exception program

I am running program like below


public class Exceptions {
public static void main(String args[]) {
int i = 100;
int j = 0;
try {
int k = i / j;
System.out.println("kw");
System.out.println("kk");
} catch (java.lang.ArithmeticException ae) {
System.out.println("Arithmetic Exception handled");
}
System.out.println("Hello World");
}
}

I got output like

Arithmetic Exception handled
Hello World


I wonder why kw and kk not printed even though I caught the exception using catch block. Please advise
JavaJava EEJSP

Avatar of undefined
Last Comment
rsly

8/22/2022 - Mon