Pergunta de entrevista da empresa Infinite Computer Solutions

What is difference between Throw vs throws?

Resposta da entrevista

Sigiloso

25 de mar. de 2022

throw The throw keyword in Java is used to explicitly throw an exception from a method or any block of code. We can throw either checked or unchecked exception. throws throws is a keyword in Java which is used in the signature of method to indicate that this method might throw one of the listed type exceptions. The caller to these methods has to handle the exception using a try-catch block.