throws is a Java keyword. It is used in a method definition to declare the Exceptions to be thrown by the method.
Java distinguishes between checked and unchecked exceptions. Unchecked exceptions (RuntimeException
, Error
, and their subclasses) can be thrown without restriction. But if a method can generate a checked exception, the compiler requires that it either be caught (with a try/catch block) or declared in the method signature with the throws
keyword.
https://en.wikibooks.org/wiki/Java_Programming/Keywords/throws https://docs.oracle.com/javase/tutorial/essential/exceptions/declaring.html