# Exception Handling

Using try, catch, and related statements to respond to failures.

## What is **Exception Handling** in Java?

**Exception Handling** — Using try, catch, and related statements to respond to failures.

```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

- [Exception Handling in C#](https://www.ask-codey.com/glossary/exception-handling-c-sharp)

Source: https://www.ask-codey.com/glossary/exception-handling
