checkException和RuntimeException

来源:互联网 发布:windows 平板电脑推荐 编辑:程序博客网 时间:2024/06/08 22:21
checked exception:指的是编译时异常,该类异常需要本函数必须处理的,用try和catch处理,或者用throws抛出异常,然后交给调用者去处理异常。
runtime exception:指的是运行时异常,该类异常不必须本函数必须处理,当然也可以处理。
Thread.sleep()抛出的InterruptException属于checked exception;IllegalArgumentException属于Runtime exception;
原创粉丝点击