The throws ( with an s at the end ) keyword is used to specify that if a method is is going to throw any exception at all. On the other hand , the throw keyword is used to explicitly throw an exception. For example
A very simple question arises that what is the purpose of declaring a method with throws, when you are not throwing any exception. The answer is that sometimes you want the Exception to propagate to the method stack above. The two keywords can be used in conjunction like this
Do post back for any further queries.
Muhammad Saif Asif Mirza
OCJA(5/6) OCJP(6) OCJWCD(6)
posted 4 years ago
Welcome to the Ranch
I suggest you find a tutorial about Java exceptions: there is a good one here.