Throws Keyword in Java with Example
throw new IOException(“can not open connection”);
throws IOException, ArrayIndexBoundException;
The “Java throw keyword” is used to declare an exception. For any method that will “throw” an exception, it is mandatory that in the calling method, you use throws to list the exception thrown.