Newer
Older
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
// Source: http://stackoverflow.com/questions/3779285/exception-thrown-in-catch-and-finally-clause
class MyExc1 extends Exception {}
class MyExc2 extends Exception {}
class MyExc3 extends MyExc2 {}
public class TryCatchFinally {
public static void foo() throws Exception {
int x ;
try {
x = 1;
try
{
throw new MyExc1();
}
catch (Exception y)
{
}
finally
{
x = 3;
throw new Exception();
}
}
catch (Exception i)
{
throw new MyExc2();
}
finally {
x = 2;
}
}
static void q() throws Exception {
}
}