How does JVM handles RuntimeException(s)

后端 未结 2 1966
误落风尘
误落风尘 2021-01-06 02:28

While creating custom exceptions, If we want to create a checked Exception we extend the Exception class and for unchecked exception we ext

相关标签:
2条回答
  • 2021-01-06 03:25

    You are mistaken that the JVM handles the exceptions differently, but your question is still valid if you are asking how the compiler treats them differently.

    And this has a simple answer: the rule does not state that all subclasses of Exception are checked exceptions. Those which are also subclasses of RuntimeException are unchecked.

    0 讨论(0)
  • 2021-01-06 03:28

    It doesn't. The only difference is in requirements enforced by the compiler.

    0 讨论(0)
提交回复
热议问题