Skip to content

Latest commit

 

History

History
14 lines (5 loc) · 435 Bytes

Java Records.md

File metadata and controls

14 lines (5 loc) · 435 Bytes

Java Records

j

Java 16 introduced a new feature called Records, which provides a compact syntax for declaring classes whose main purpose is to store data. Records are immutable by default, and they provide a concise way to define classes that encapsulate data.

Example:

public record Person(String name, int age) {}