How to know which exception is thrown

前端 未结 4 859
清歌不尽
清歌不尽 2021-02-03 11:29

I\'m doing a review for our codebase, and there are many statements like this:

try
{
   doSomething()
} catch (Exception e)
{

}

but I would l

4条回答
  •  离开以前
    2021-02-03 12:19

    If there is no throws clause, then the method does not throw any checked execption. The javadoc of that method might give information about any unchecked exceptions the method can throw, but it does not have to.

    Why do you want to catch any exceptions in the first place?

提交回复
热议问题