- Throws clause in used to declare an exception and throw keyword is used to throw an exception explicitly.
- If we see syntax wise then throw is followed by an instance variable and throws is followed by exception class names.
- The keyword throw is used inside method body to invoke an exception and throws clause is used in method declaration (signature).
Collections of the interview question asked frequently in JAVA/Middleware interviews. The contents present are referred from some of the popular blogging sites to make everything under one roof :)
Thursday, 31 July 2014
Throws vs Throw
Labels:
Exception Handling,
Throw,
Throws
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment