Pergunta de entrevista da empresa Apisero

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

Respostas da entrevista

Sigiloso

6 de ago. de 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

Sigiloso

9 de abr. de 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