KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > TestGenerics


1 public class TestGenerics <E extends java.lang.Exception JavaDoc,
2                            RE extends RuntimeException JavaDoc & java.io.Serializable JavaDoc>
3 {
4     /**
5      * @throws E in some cases
6      * @throws RE in some cases
7      */

8     public void method1() throws E
9     {
10     }
11
12     /**
13      * RuntimeException is not declared.
14      */

15     public void method2() throws RE
16     {
17     }
18
19     /**
20      * @throws E in some cases
21      * @throws RE in other cases
22      */

23     public void method3() throws E, RE
24     {
25     }
26
27     /**
28      * @throws RE in some cases
29      * @throws NPE in some other cases
30      */

31     public <NPE extends NullPointerException JavaDoc> void method4() throws NPE, RE
32     {
33     }
34
35     public class InnerClass <RuntimeException extends ClassCastException JavaDoc>
36     {
37         /**
38          * @throws E in some case
39          * @throws RE in some other cases
40          */

41         public void method1() throws RuntimeException JavaDoc, RE,
42             java.lang.RuntimeException JavaDoc
43         {
44         }
45     }
46 }
47
Popular Tags