Created
January 15, 2021 13:53
-
-
Save gyselph/e475e9d7c4d6dfcc59c3e2bd4cb7808a to your computer and use it in GitHub Desktop.
Java 7 to 15: record
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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