Which Java version standardized the 'record' keyword for data classes?

The story behind the answer

Java 16 standardized the record keyword for concise data-carrier classes. Records became a permanent Java language feature through JEP 395, delivered in JDK 16.

A record declaration such as record Point(int x, int y) describes its state directly. Java automatically supplies component accessors, a canonical constructor, and implementations of equals, hashCode, and toString. Record classes are implicitly final and extend java.lang.Record, so they are designed for transparent data modeling rather than ordinary inheritance.

The feature was introduced gradually. Records first appeared as a preview feature in Java 14 through JEP 359, then returned as a refined preview in Java 15 through JEP 384. Feedback from those previews informed the final version in Java 16, including changes to constructor access and nesting rules.

The keyword is often confused with Java 17 because Java 17 is a major long-term-support release and is widely adopted. However, records were already standardized one release earlier. Records also do not make every referenced object deeply immutable: their component fields are final, but a component can still refer to a mutable object.

Source: Wikipedia · fact-checked Aug. 2026

Add question to a list

Choose a list to keep this question in: