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
最新推荐文章于 2024-06-13 17:53:51 发布
本文深入探讨了Java中异常处理的概念,特别关注检查异常与非检查异常的区别,并通过具体代码实例展示了非检查异常的使用场景。

602

被折叠的 条评论
为什么被折叠?



