Exception other than RuntimeException

前端 未结 3 553
臣服心动
臣服心动 2020-11-30 15:27

Is there any possibility of exceptions to occur other than RuntimeException in Java? Thanks.

3条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-30 16:22

    Basically in java (opposed to .NET) you have two types of exceptions:

    • Checked Exception: All classes that inherit from exception. Client code has to handle this kind of exceptions (enforced in the compiler) via try-catch or throws clause.
    • Unchecked Exception: All classes that inherit from RuntimeException. Client code does not have to handle this type of exceptions.

    May I suggest the following O'Reilly On Java Exception article.

提交回复
热议问题