# throw

A statement that deliberately raises an exception object.

## What does **throw** do in Java?

**throw** — A statement that deliberately raises an exception object.

```java
class Reservation {
    void reserve(int seats) {
        if (seats < 1) {
            throw new IllegalArgumentException("seats");
        }
    }
}
```

Level: Journeyman · [More Java terms at this level](https://www.ask-codey.com/glossary/subjects/java/journeyman)

Updated: September 27, 2026

## In other subjects

- [throw in C#](https://www.ask-codey.com/glossary/throw-c-sharp)
- [throw in JavaScript](https://www.ask-codey.com/glossary/throw-javascript)

Source: https://www.ask-codey.com/glossary/throw
