freeCodeCamp/guide/english/java/throw-keyword/index.md

410 B

title
Throw

throw

The Java throw keyword is used to explicitly throw an exception.You can throw either checked or uncheked exception in java by throw keyword. The throw keyword is mainly used to throw custom exception.

Example:

throw new ArithmeticException("/ by zero not permitted");
More resources

Geeks for Geeks