# Assertion

A development-time check that reports when an expected condition is false.

## What is **Assertion** in Java?

**Assertion** — A development-time check that reports when an expected condition is false.

```java
class Inventory {
    void checkQuantity(int quantity) {
        assert quantity >= 0 : "quantity cannot be negative";
    }
}
```

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

Updated: September 27, 2026

## In other subjects

- [Assertion in Unit Testing](https://www.ask-codey.com/glossary/assertion-unit-testing)

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