When to use throws in a Java method declaration?

后端 未结 7 1218
情话喂你
情话喂你 2020-12-07 14:10

So I thought I had a good basic understanding of exception-handling in Java, but I was recently reading some code that gave me some confusion and doubts. My main doubt that

7条回答
  •  再見小時候
    2020-12-07 14:49

    You're correct, in that example the throws is superfluous. It's possible that it was left there from some previous implementation - perhaps the exception was originally thrown instead of caught in the catch block.

提交回复
热议问题