示例 1:
// 在 Java 17 和更高版本下,所有代码都是隐式 strictfp
strictfp class X {
// 内部枚举为隐式 static
static enum Inner {
A, B, C
}
// 内部记录为隐式 static
static record R() {
}
}
示例 2:
final record R() {
// 所有记录均为隐式 final
}
示例 3:
// 所有接口均为隐式 abstract
abstract interface Printer {
// 所有接口成员均为隐式 public
public int size();
// 接口的所有内部类均为隐式 static
static class Inner {}
}