+ 2
What is difference between throws and throw?
2 odpowiedzi
+ 2
With throw you can raise an exception.
Throws can be added to method signatures, to indicate which kind of Exceptions have to be expected when using it. You would do that e.g. when you create a file reader method with general approach, so that you cannot or do not want to handle the follow up workflow, but let the caller decide how to act on exceptions occuring during file access.