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

17 lines
410 B
Markdown
Raw Normal View History

2018-10-12 19:37:13 +00:00
---
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:***
```java
throw new ArithmeticException("/ by zero not permitted");
```
##### More resources
[Geeks for Geeks](https://www.geeksforgeeks.org/throw-throws-java/)