# throw

say it: **“THROH”** **/θroʊ/**

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?category=java&level=3)

Updated: November 17, 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)
- [throw in PowerShell](https://www.ask-codey.com/glossary/throw-powershell)

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