On the source code below I\'m rethrowing an Exception
.
Why is it not necessary to put the throws
keyword on the method\'s signature?
When you use throws with a method, it means that the statement which will call that method must be surrounded with a try catch block.
But if the method already includes try catch block then no thorws declaration is needed as the exception being thrown by the method is being handled there only.
The statement calling this method does not need a to be surrounded with try catch block.
Hope this clears your doubt.