A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

wangenbin

初级黑马

  • 黑马币:76

  • 帖子:32

  • 精华:0

© wangenbin 初级黑马   /  2016-1-13 22:07  /  833 人查看  /  2 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

No exception of type Exception can be thrown; an exception type
must be a subclass of Throwable
这句话是什么意思啊
还有下面一段代码,为什么没办法抛异常
class Demo
{
        int div(int a,int b) throws Exception
        {
                return a/b;
       
        }
}
class Exception
{
        public static void main(String[] args) throws Exception
        {
                Demo d=new Demo();
               
                        int x=d.div(4,1);
                        System.out.println("x="+x);
                        System.out.println("over");
               
               
               
        }
}
求助

2 个回复

倒序浏览
抛RuntimeException就可以了,是抛大了吗?
回复 使用道具 举报
看看学习一下
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马