-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathJavaExceptionDemo02.java
More file actions
43 lines (39 loc) · 969 Bytes
/
Copy pathJavaExceptionDemo02.java
File metadata and controls
43 lines (39 loc) · 969 Bytes
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
40
41
42
43
package JavaException;
/**
* The type Java exception demo 02.
* <p>
* 多数情况下,创建自定义异常需要继承Exception,
* 本例继承Exception的子类RuntimeException
*/
public class JavaExceptionDemo02 extends RuntimeException {
/**异常对应的返回码*/
private String retcd;
/**异常对应的描述信息**/
private String masgDes;
public JavaExceptionDemo02(){
super();
}
public JavaExceptionDemo02(String message){
super(message);
masgDes =message;
}
public JavaExceptionDemo02(String retcd,String masgDes){
super();
this.retcd = retcd;
this.masgDes = masgDes;
}
public String getRetcd(){
return retcd;
}
public String getMasgDes(){
return masgDes;
}
}
class TestClass{
public void testException() throws JavaExceptionDemo02{
try {
}catch (Exception e){
throw new JavaExceptionDemo02("1212a2","String[]");
}
}
}