java has two type of exception, one is checked exception and another is unchecked exception.
checked exception inherit from the java.lang.Exception and unchecked exception inherit from java.lang.RuntimeException.
checked exception must catch or throw while unchecked exceptin no need.
Below code will throw an unchecked exception:
java.lang.ArithmeticExceptionpublic static void main(String[] args) { int result = 1/0; }
[Interview]The java exception type
最新推荐文章于 2018-09-07 15:46:38 发布