record
A class declared by listing its components; Java writes the fields, constructor, accessors, equals, hashCode and toString.
A record is an implicitly final class whose state is its record components, held in private final fields; the compiler generates the canonical constructor, accessors, and component-wise equals, hashCode and toString.
Examples
record Point(int x, int y) {}gets a constructor,x(),y(),equals,hashCodeandtoString.
See also