public static void main(String[] args) {
System.out.println(abc());
}
public static Integer abc(){
System.out.println("开始");
try{
System.out.println("报错前");
int i = 1/0;
System.out.println("报错了");
return 1;
}finally{
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("小样");
}
}
输出顺序: 开始
报错前
小样
exception / by zero