-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathException2.java
More file actions
39 lines (34 loc) · 1.01 KB
/
Exception2.java
File metadata and controls
39 lines (34 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import java.util.ArrayList;
/**
* Created by Admin on 14-04-2017.
*/
public class Exception2 {
public static void throwExceptions() throws ClassNotFoundException{
try{
throw new NullPointerException("ABC");
// new Exception2.throwsNestedException(){
// @Override
// public void throwsNestedException() {
// throw new NullPointerException("ABC");
// }
// };
}catch (NullPointerException e){
if(true) {
throw new ClassNotFoundException();
}
System.out.println(e);
e.printStackTrace();
}
}
public static void main(String[] args){
try {
throwExceptions();
}catch (Exception e){
System.out.println(e);
e.printStackTrace();
}
}
public static interface throwsNestedException{
public void throwsNestedException();
}
}