https://www.youtube.com/watch?v=3k2bIMFeIp8
Java 23 will loosen restrictions on how the super()
method will be called. It need not be called the first operation in the derived constructor.
super
call to the Base Classes constructor will be permitted after initializing the variables.String value;
public Constructor(String aValue) {
value = aValue
super()
}
super
call will also be permitted after a static
methodpublic Constructor(String aValue) {
value = aValue;
check(value)
super()
}
public static void check(value) {
...
}
super
can now also accept local variables that have been modified prior to its callpublic Constructor(String aValue) {
var value = aValue * 2;
super(value,value)
}
The reason the changes above were made was so as to allow both
<aside> 💡 The JVM is not doing different things; it is just doing things differently
</aside>