-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathDemo.java
executable file
·53 lines (39 loc) · 1.13 KB
/
Demo.java
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
51
52
53
package tutorialquestions.question153d;
public class Demo {
public static void main(String[] args) {
try {
try {
try {
try {
switch (Integer.parseInt(args[0])) {
case 0:
throw new A();
case 1:
throw new B();
case 2:
throw new C();
default:
// Nothing.
}
} catch (C exception) {
System.out.println(exception);
throw exception;
}
} catch (B exception) {
System.out.println(exception);
throw exception;
}
} catch (A exception) {
System.out.println(exception);
throw exception;
}
System.out.println("No exception was thrown.");
} catch (NumberFormatException exception) {
System.out.println("The command-line argument you entered was not an integer!");
} catch (Exception exception) {
System.out.println("An exception was thrown: " + exception);
} finally {
System.out.println("All control-flow paths get to me!");
}
}
}