Files
javademos/java25-features/broken/ThisBeforeSuper.java
T

13 lines
406 B
Java

// JEP 513 allows statements before super(), but not anything that reads `this`.
public class ThisBeforeSuper {
static class Base { Base() {} }
static class Child extends Base {
int side = 4;
String describe() { return "child"; }
Child() {
System.out.println(describe()); // instance method call before super(): rejected
super();
}
}
}