-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExceptionDemo.java
47 lines (43 loc) · 1022 Bytes
/
ExceptionDemo.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
public class Main {
public static void main(String[] args)
{
System.out.println("********* DENEME *********");
Main m1 = new Main();
Main m2 = new Main();
System.out.println("m1 : " + m1.toString());
System.out.println("m2 : " + m2.toString());
System.out.println("**************************");
try {
procA();
} catch (Exception e) {
System.out.println("Exc. yakalanýyor");
}
procB();
procC();
}
static void procA() {// metot dýþýnda excption
try {
System.out.println("procA içinde");
throw new RuntimeException("demo");
} finally {
System.out.println("procA's finally");
}
}
// Bir try bloðundan geri dön
static void procB() {
try {
System.out.println("procB içinde");
return;
} finally {
System.out.println("procB'deki finally");
}
}
// Bir try bloðunu normal iþle.
static void procC() {
try {
System.out.println("procC içinde");
} finally {
System.out.println("procC'deki finally");
}
}
}