# Optional

A container that explicitly represents either one non-null value or no value.

## What is **Optional** in Java?

**Optional** — A container that explicitly represents either one non-null value or no value.

```java
import java.util.Optional;

class Profile {
    Optional<String> nickname = Optional.of("Ace");
}
```

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

Updated: September 27, 2026

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