class MyMath{
public static int div(int x, int y) throws Exception{
return x/y;
}
}
//public class ThrowsDemo {
// public static void main(String[] args) {
// try{System.out.println(MyMath.div(10,2));
// }catch (Exception e){
// e.printStackTrace();
// }
//
// }
//}
public class ThrowsDemo {
public static void main(String[] args) throws Exception {
System.out.println(MyMath.div(10,2));
}
}
Java异常throws关键字
最新推荐文章于 2023-06-24 11:13:15 发布