import java.util.concurrent.TimeoutException;
public class TestException {
public static void main(String[] args) {
int x;
for (int i = 1; i <= 3; i++) {
try {
System.out.println("Before exception round " + i);
x = 1 / (i - 2);
System.out.println("After exception round " + i);
} catch (ArithmeticException e) {
e.printStackTrace();
}
System.out.println("Round " + i);
}
}
}
java.lang.ArithmeticException: / by zero
at TestException.main(TestException.java:9)
Before exception round 1
After exception round 1
Round 1
Before exception round 2
Round 2
Before exception round 3
After exception round 3
Round 3