Skip to content

Instantly share code, notes, and snippets.

@gyselph
Created January 15, 2021 13:53
Java 7 to 15: record
jshell> record Employee (String name, int age, String department) {}
| created record Employee
jshell> var x = new Employee("Anne", 25, "Legal");
x ==> Employee[name=Anne, age=25, department=Legal]
jshell> x.name()
$2 ==> "Anne"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment