+ 1
Is there really a difference using throws statements or not?
If you delete the throws statement in the declaration the same result occurs! So why use it in the first place?
2 odpowiedzi
+ 2
Throws tells other programmers who use your methods, that these might throw an exception. They are forced to implement try/catch then - or another throw.
0
There is definitely a very big difference using throws or without one.
Whenever you want your code to catch the exception in the method where is your try block is you should have to use only throw.
But if the situation is that, you want your code to catch the exception at the point from where method of the try block holder is called, you shoul have to use throws also.