1
JavaAdvanced#fundamentals#java17
Records are immutable data carrier classes that automatically generate constructors, accessors, equals(), hashCode(), and toString() based on their declared components, reducing boilerplate for DTOs.
record Point(int x, int y) {}
Point p = new Point(1, 2);
p.x(); // 1
System.out.println(p); // Point[x=1, y=2]