Question d’entretien chez Apisero

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

Réponses aux questions d'entretien

Utilisateur anonyme

6 août 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

Utilisateur anonyme

9 avr. 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