, , , .
, ( ), , , , init()
, , , init
, SubModel
.
Java " 17: " :
" , , . , . , . , . , , , . , , :"
, :
" , overrideMe
, Super
:
public class Super {
public Super() {
overrideMe();
}
public void overrideMe() {
}
}
public final class Sub extends Super {
private final Date date;
Sub() {
date = new Date();
}
@Override public void overrideMe() {
System.out.println(date);
}
public static void main(String[] args) {
Sub sub = new Sub();
sub.overrideMe();
}
}
" , , null , overrideMe
Super Sub
. , ! , overrideMe
date
, NullPointerException
, Super
overrideMe
. , NullPointerException
println
."
, , , : , , , . , , .
, , , , , , , , , , . , - , , , , , , , - , .