---
spec: JLS
title: "The Java Language Specification"
edition: "Java SE 27 Edition"
java_version: 27
chapter: "Chapter 8. Classes"
section: "8.10"
heading: "8.10. Record Classes"
parent: "Chapter 8. Classes"
source: https://docs.oracle.com/javase/specs/jls/se27/html/jls-8.html#jls-8.10
id: "8.10"
url: https://jvm.obfuscated.software/jls/se27/8.10.html
raw: https://jvm.obfuscated.software/jls/se27/8.10.md
---

# 8.10. Record Classes

A *record declaration* specifies a new record class, a restricted kind of class that defines a simple aggregate of values.

```
RecordDeclaration:
  {ClassModifier} record TypeIdentifier [TypeParameters] RecordHeader [ClassImplements] RecordBody
```

A record declaration may specify a top level record class ([§7.6](7.6.md)), a member record class ([§8.5](8.5.md), [§9.5](9.5.md)), or a local record class ([§14.3](14.3.md)).

The *TypeIdentifier* in a record declaration specifies the name of the record class.

It is a compile-time error if a record declaration has the modifier `abstract`, `sealed`, or `non-sealed`.

A record class is implicitly `final`. It is permitted for the declaration of a record class to redundantly specify the `final` modifier.

A nested record class is implicitly `static`. That is, every member record class and local record class is `static`. It is permitted for the declaration of a member record class to redundantly specify the `static` modifier, but it is not permitted for the declaration of a local record class ([§14.3](14.3.md)).

It is a compile-time error if the same keyword appears more than once as a modifier for a record declaration, or if a record declaration has more than one of the access modifiers `public`, `protected`, and `private` ([§6.6](6.6.md)).

The direct superclass type of a record class is `Record` ([§8.1.4](8.1.4.md)).

A record declaration does not have an `extends` clause, so it is not possible to explicitly declare a direct superclass type, even `Record`.

The serialization mechanism treats instances of a record class differently than ordinary serializable or externalizable objects. In particular, a record object is deserialized using the canonical constructor ([§8.10.4](8.10.4.md)).

**Sections:**

- [8.10.1. Record Components](8.10.1.md)
- [8.10.2. Record Body Declarations](8.10.2.md)
- [8.10.3. Record Members](8.10.3.md)
- [8.10.4. Record Constructor Declarations](8.10.4.md)
