-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNestedTryCatch.java
More file actions
28 lines (28 loc) · 928 Bytes
/
Copy pathNestedTryCatch.java
File metadata and controls
28 lines (28 loc) · 928 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
public class NestedTryCatch {
public static void main(String[] args){
try{
try{
int b=30/0;
} catch (ArithmeticException ae) {
System.out.println(ae);
}
try{
int a[]=new int[5];
a[10]=40;
}catch (ArrayIndexOutOfBoundsException abe){
System.out.println(abe);
}
try{
String s= null;
int len= s.length();
}catch (StringIndexOutOfBoundsException sie ){
System.out.println(sie);
}
}catch (Exception e){
System.out.println("Parent exception");
}finally{
System.out.println("Finally is always executed.");
}
System.out.println("rest of the code...");
}
}