# catch Block

A block that handles a matching exception from its try block.

## What is **catch Block** in Java?

**catch Block** — A block that handles a matching exception from its try block.

```java
class OrderReader {
    int readQuantity(String text) {
        try {
            return Integer.parseInt(text);
        } catch (NumberFormatException error) {
            return 0;
        } finally {
            closeReader();
        }
    }

    void closeReader() {
    }
}
```

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

Updated: September 27, 2026

## In other subjects

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

Source: https://www.ask-codey.com/glossary/catch-block
