Apisero interview question

Explain the difference between "throw" and "throws" keyword

Interview Answers

Anonymous

6 Aug 2020

The "throws" is used at the time of method declaration / after method signature indication that this method may throws Exception to the calling method while the "throw" is used within the method. along with the new instance of Exception

9

Anonymous

9 Apr 2021

throw is used to throw customized exception while throws is used in method signature to declare an exception which might get thrown by method

3