|
5 | 5 | * Resource Acquisition Is Initialization pattern was developed |
6 | 6 | * for exception safe resource management by C++ creator Bjarne |
7 | 7 | * Stroustrup. |
8 | | - * |
| 8 | + * <p> |
9 | 9 | * In RAII resource is tied to object lifetime: resource allocation |
10 | 10 | * is done during object creation while resource deallocation is |
11 | 11 | * done during object destruction. |
12 | | - * |
| 12 | + * <p> |
13 | 13 | * In Java RAII is achieved with try-with-resources statement and |
14 | | - * interfaces Closeable and AutoCloseable. The try-with-resources |
| 14 | + * interfaces {@link Closeable} and {@link AutoCloseable}. The try-with-resources |
15 | 15 | * statement ensures that each resource is closed at the end of the |
16 | | - * statement. Any object that implements java.lang.AutoCloseable, which |
17 | | - * includes all objects which implement java.io.Closeable, can be used |
| 16 | + * statement. Any object that implements {@link java.lang.AutoCloseable}, which |
| 17 | + * includes all objects which implement {@link java.io.Closeable}, can be used |
18 | 18 | * as a resource. |
19 | 19 | * |
20 | | - * In this example, SlidingDoor implements AutoCloseable and |
21 | | - * TreasureChest implements Closeable. Running the example, we can |
| 20 | + * In this example, {@link SlidingDoor} implements {@link AutoCloseable} and |
| 21 | + * {@link TreasureChest} implements {@link Closeable}. Running the example, we can |
22 | 22 | * observe that both resources are automatically closed. |
23 | | - * |
| 23 | + * <p> |
24 | 24 | * http://docs.oracle.com/javase/7/docs/technotes/guides/language/try-with-resources.html |
25 | 25 | * |
26 | 26 | */ |
27 | 27 | public class App { |
28 | 28 |
|
| 29 | + /** |
| 30 | + * Program entry point |
| 31 | + * @param args command line args |
| 32 | + * @throws Exception |
| 33 | + */ |
29 | 34 | public static void main( String[] args ) throws Exception { |
30 | 35 |
|
31 | 36 | try (SlidingDoor slidingDoor = new SlidingDoor()) { |
|
0 commit comments