-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathNestedCode.java
More file actions
50 lines (35 loc) · 905 Bytes
/
Copy pathNestedCode.java
File metadata and controls
50 lines (35 loc) · 905 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import java.io.EOFException;
import java.io.IOException;
public class NestedCode {
public static void main(String args[]) {
try{
int x = 23;
int y = 0;
System.out.println(1);
System.out.println(2);
int arr[]={4,6};
arr[10] = 90;
System.out.println(3);
}
catch(ArithmeticException | IndexOutOfBoundsException e){
System.out.println(4);
System.out.println(e.toString());
}
catch(RuntimeException e){
System.out.println(5);
System.out.println(e.toString());
}
System.out.println(6);
}
static int method1(){
// some task
method2();
return 0;
}
static int method2(){
// some task
int z =0;
int y = 50/z;
return 0;
}
}