OnJava8-Examples/collections/ImplementingRecord.java

15 lines
403 B
Java
Raw Permalink Normal View History

2021-09-20 17:33:35 -06:00
// collections/ImplementingRecord.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 16
interface Star {
double brightness();
double density();
}
record RedDwarf(double brightness) implements Star {
@Override public double density() { return 100.0; }
}