Should I declare unchecked exceptions in the throws specification?

前端 未结 3 1995
粉色の甜心
粉色の甜心 2021-01-31 09:13

I\'m aware checked exceptions have to be handled or specified, but unchecked exceptions are optional.

If for some reason I can reasonably expect an unchecked exception t

3条回答
  •  梦毁少年i
    2021-01-31 09:28

    explicitly declaring in throws-clause is not necessary since it is about runtime exceptions, but you should document it in javadoc so users can see under which circumstances this exception might occur and what does it mean.

提交回复
热议问题