public class TestT {
public static void a() throws Exception{ //抛出异常给上级处理
try {
b() ;
} catch (Exception e) {
throw new Exception(e) ;
}
}
public static void b() throws Exception{ //抛出异常给上级处理
try {
c() ;
} catch (Exception e) {
throw new Exception(e);
}
}
public static void c() throws Exception { //抛出异常给上级处理
try {
throw new NullPointerException("c 异常链中的空指针异常..") ;
} catch (NullPointerException e) {
throw new Exception(e) ;
}
}
public static void main(String[]args){
try {
a() ;
} catch (Exception e) {
e.printStackTrace();
}
}
}
public class MyTest {
public void open() throws Exception{
throw new Exception(){
public String toString() {
return this.getClass().getName()+"CeryImmportException";
};
} ;
}
public void close() throws Exception{
throw new Exception(){
public String toString() {
return this.getClass().getName()+"close Exception" ;
};
} ;
}
public void three() throws Exception{
throw new Exception(){
public String toString() {
return this.getClass().getName() + "three" ;
};
} ;
}
public static void main(String[]agrs){
MyTest mt=new MyTest() ;
try{
try{
try{
mt.open();
}finally
{
System.out.println("delete open");
mt.close() ;
}
}
finally{
System.out.println("delete close");
mt.three() ;
}
}catch(Exception ex){
ex.printStackTrace();
}
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有