Java Records
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) {}
No comments:
Post a Comment