Isn't an unchecked exception that is caught in a try block a checked exception in Java?

后端 未结 3 1759
执笔经年
执笔经年 2021-02-08 23:05

I was told that in Java, unchecked exceptions can be caught in a try block, but if it\'s caught, isn\'t it called a checked exception?

3条回答
  •  别那么骄傲
    2021-02-08 23:51

    I think the distinction is that the compiler will flag uncaught checked exceptions and methods that throw checked exceptions but don't declare them in the method signature at compile time.

    Unchecked exceptions don't require declaration or catching, but neither are prohibited. The compiler just doesn't identify them as errors.

提交回复
热议问题