forked from akash-coded/C133-Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExceptionExample.java
More file actions
23 lines (22 loc) · 785 Bytes
/
Copy pathExceptionExample.java
File metadata and controls
23 lines (22 loc) · 785 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
public class ExceptionExample {
public static void main(String[] args) {
int a = 2;
int b = 2;
int c;
System.out.println("Before exception");
c = a - b;
try {
System.out.println("Inside outer try block");
try {
System.out.println("Inside inner try block");
System.out.println(5 / c);
} catch (ArithmeticException e) {
System.out.println("Exception caught in inner catch block");
}
System.out.println("End of outer try block");
} catch (Exception e) {
System.out.println("Exception caught in outer catch block");
}
System.out.println("After exception normal execution continues");
}
}