Thursday, 31 July 2014

Throws vs Throw

  1. Throws clause in used to declare an exception and throw keyword is used to throw an exception explicitly.
  2. If we see syntax wise then throw is followed by an instance variable and throws is followed by exception class names.
  3. The keyword throw is used inside method body to invoke an exception and throws clause is used in method declaration (signature).

No comments:

Post a Comment