KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > InputRedundantThrows


1 import java.io.IOException JavaDoc;
2
3 public class InputRedundantThrows
4 {
5     // wrong contains subclasses
6
InputRedundantThrows()
7         throws java.io.IOException JavaDoc, java.io.FileNotFoundException JavaDoc
8     {
9     }
10
11     // wrong uncheck exception
12
void method1()
13         throws RuntimeException JavaDoc
14     {
15     }
16
17     // wrong - duplicate
18
void method2()
19         throws IOException JavaDoc, java.io.IOException JavaDoc
20     {
21     }
22
23     // bad - no information for checking exception
24
// void method3()
25
// throws WrongException // we will throw exception here, thus I remove it from the test input
26
// {
27
// }
28

29     // right
30
void method4()
31         throws IOException JavaDoc, ClassNotFoundException JavaDoc
32     {
33     }
34
35     void method5() throws /* WrongException, */ IOException JavaDoc
36     {
37     }
38
39     void method6() throws NullPointerException JavaDoc, RuntimeException JavaDoc
40     {
41     }
42 }
43
Popular Tags