Sollicitatievraag bij Infinite Computer Solutions

What is difference between Throw vs throws?

Antwoord op sollicitatievraag

Anoniem

25 mrt 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.