D:\CurrentProjects\SearsInterviewCode\src\java\test_classes\TestingFinallyBlock.java |
1
2
3
4
5
6 package test_classes;
7
8 import java.io.*;
9 import java.text.*;
10 import java.lang.*;
11 import java.util.*;
12
13
14
15 @author
16
17 public class TestingFinallyBlock
18 {
19 public TestingFinallyBlock()
20 {
21 test_finalyBlock();
22 }
23 public synchronized void test_finalyBlock()
24 {
25 String localString = "3^4";
26 int x = 0;
27 try
28 {
29 synchronized (this)
30 {
31 x = 2;
32 System.out.println("Try ======>:\t" + localString);
33 }
34 System.exit(0);
35 }
36 catch(Exception e)
37 {
38 System.out.println("Catch ======>:\t" + localString);
39 return;
40 }
41 finally
42 {
43 System.out.println("Finally ======>:\t" + localString);
44 }
45 }
46
47
48
49 public static void main (String[] args)
50 {
51 System.out.println("====================================================");
52 System.out.println("==================== Start ================================");
53 TestingFinallyBlock xx = new TestingFinallyBlock();
54 System.out.println("======== End ==================");
55 }
56
57 }
58
59