Skip to content

Instantly share code, notes, and snippets.

@gyselph
Created January 15, 2021 13:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gyselph/e475e9d7c4d6dfcc59c3e2bd4cb7808a to your computer and use it in GitHub Desktop.
Save gyselph/e475e9d7c4d6dfcc59c3e2bd4cb7808a to your computer and use it in GitHub Desktop.
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