Created
January 15, 2021 13:53
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