Java中throw与throws用法有何不同之处?
- 内容介绍
- 文章标签
- 相关推荐
本文共计386个文字,预计阅读时间需要2分钟。
代码实例:+ 问题:为什么testRunntimeException()方法没有出现编译错误,而testCheckedException()方法却出现未处理的异常 + 分析:Exception分为两类:checked exception、runtime exception;直接继承自Exception的为checked exception,而直接继承自Throwable的为runtime exception。
本文共计386个文字,预计阅读时间需要2分钟。
代码实例:+ 问题:为什么testRunntimeException()方法没有出现编译错误,而testCheckedException()方法却出现未处理的异常 + 分析:Exception分为两类:checked exception、runtime exception;直接继承自Exception的为checked exception,而直接继承自Throwable的为runtime exception。

