Articles → Java → Throw Vs Throws in Java

Throw Vs Throws in Java



ThrowThrows
Throw keyword is used to explicitly throw an exceptionThrows keyword is used to declare an exception in the method.
Throw keyword is used within the methodThrows keyword is used in method signature
You cannot throw multiple exceptions in one method.You can declare multiple exceptions using throws keyword.
Syntax wise, throw is followed by new keyword.Throws is followed by exception class name.



Posted By  -  Karan Gupta
 
Posted On  -  Thursday, November 30, 2017

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250