Java : 抛个异常
`A` RuntimeException is the superclass of those exception...
扫描右侧二维码阅读全文
09
2021/11

Java : 抛个异常

`A` RuntimeException is the superclass of those exceptions that can be thrown during the normal operation of the Java Virtual Machine.
 `B` A method is not required to declare in its throws clause any subclasses of RuntimeExeption that might be thrown during the execution of the method but not caught
  `C` An RuntimeException is a subclass of Throwable that indicates serious problems that a` reasonable application should not try to catch.
 `D` NullPointerException is one kind of RuntimeException

6614221_1498014966222_66942F084D0121FD64A706B9B6370D7A.png

四个选项都来自于Java API原文.
A选项是RuntimeException的定义;
B选项是把Error的第二段定义拿来改掉换成RuntimeException,但这样说对于RuntimeException也没错;
C选项也是把Error的定义换成了RuntimeException,但这里的"indicates serious problems"不应该用在RuntimeException上,Error才表示严重的错误,RuntimeException并不是.
D选项显然.
具体可查看API,网址http://docs.oracle.com/javase/7/docs/api/java/lang/Error.html

Last modification:November 9th, 2021 at 07:41 pm
If you think my article is useful to you, please feel free to appreciate

Leave a Comment