java throws处理

来源:互联网 发布:变更ip地址软件 编辑:程序博客网 时间:2024/06/06 06:52
View Code
 1 class Math{
2 public int div(int i,int j) throws Exception{
3 int t=i/j;
4 return t;
5 }
6 }
7 public class ThrowsDemo {
8 public static void main(String args[]) throws Exception{
9 Math m=new Math();
10 System.out.println("出发操作:"+m.div(10,2));
11 }
12 }

主方法使用throws关键字

原创粉丝点击