int i=10/0;
try {
} catch (Exception e) {
// TODO: handle exception
System.out.println("0不能作为除数");
}finally {
// TODO: handle finally clause
}
如果不使用try-----catch,则异常会交由jvm虚拟机处理
int i=10/0;
try {
} catch (Exception e) {
// TODO: handle exception
System.out.println("0不能作为除数");
}finally {
// TODO: handle finally clause
}
如果不使用try-----catch,则异常会交由jvm虚拟机处理