KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > spoon > examples > resource > src > Main


1 package spoon.examples.resource.src;
2
3 /**
4  * A program that uses a resource (to be analyzed by Spoon to detect wrong
5  * usages).
6  */

7 public class Main {
8
9     public static void main(String JavaDoc[] args) {
10         Resource r = new Resource();
11         Resource r2 = new Resource();
12         // r.open();
13
r.open();
14         try {
15             r.read();
16         } catch(Exception JavaDoc e) {
17             e.printStackTrace();
18         }
19         m(r);
20         r2.open();
21         r.close();
22         // if(r.toString().endsWith("x")) {
23
// r.close();
24
// }
25
// r.close();
26
// m(r);
27
// r.close();
28
}
29
30     static void m(Resource r) {
31         r.close();
32     }
33
34 }
35
Popular Tags