Skip to content

Latest commit

 

History

History
19 lines (13 loc) · 506 Bytes

File metadata and controls

19 lines (13 loc) · 506 Bytes

Declaration

To declare a record you write the word record followed by a class name, a list of "record components" in parentheses, and a pair of {}.

The list of record components should be reminiscent of function arguments.

record Person(String name, int age) {}

Having an empty list of record components is also allowed.1

record Pants() {}

Footnotes

  1. As to why you might want to give an empty list of record components, it's nuanced. For now it's just for fun.