Luigit
repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by admin

pi/agent/skills/optional/java/java-flexible-constructors/examples/jep-513.md

Raw
Rendered preview

JEP 513 examples

Source: https://openjdk.org/jeps/513

class Employee extends Person {
    Employee(String name, int age) {
        if (age < 0) throw new IllegalArgumentException("age");
        super(name, age);
    }
}
class Sub extends Super {
    final int id;

    Sub(int id) {
        this.id = id; // same-class uninitialized field
        super();
    }
}
# [JEP 513](https://openjdk.org/jeps/513) examples

Source: https://openjdk.org/jeps/513

```java
class Employee extends Person {
    Employee(String name, int age) {
        if (age < 0) throw new IllegalArgumentException("age");
        super(name, age);
    }
}
```

```java
class Sub extends Super {
    final int id;

    Sub(int id) {
        this.id = id; // same-class uninitialized field
        super();
    }
}
```