Exception is never thrown in body of corresponding try statement

后端 未结 4 1761
别那么骄傲
别那么骄傲 2020-12-03 05:14

I have a problem with exception handling in Java, here\'s my code. I got compiler error when I try to run this line: throw new MojException(\"Bledne dane\");. T

4条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-03 05:42

    Always remember that in case of checked exception you can catch only after throwing the exception(either you throw or any inbuilt method used in your code can throw) ,but in case of unchecked exception You an catch even when you have not thrown that exception.

提交回复
热议问题