OnJava8-Examples/interfaces/SealedRecords.java
2021-09-20 17:33:35 -06:00

13 lines
397 B
Java

// interfaces/SealedRecords.java
// (c)2021 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information.
// {NewFeature} Since JDK 17
sealed interface Employee
permits CLevel, Programmer {}
record CLevel(String type)
implements Employee {}
record Programmer(String experience)
implements Employee {}