Short answer
A record (Java 16) is a transparent carrier for immutable data: from the header it generates final fields, a canonical constructor, accessors, and value-based equals/hashCode/toString.
Explanation
It is ideal for DTOs, value objects, and multiple return values. It is the wrong choice when you need mutability, want to hide or transform internal representation, need inheritance (records are implicitly final and extend Record), or when equality should be identity-based rather than component-based.
Common mistakes
- Using records for JPA entities that need mutability and a no-arg constructor.
- Thinking records make referenced objects immutable too.