Static interface methods are not inherited by subclasses
You cannot access static interface methods through instances. You must access them statically. This is slightly different from classes in which access to a static method through an instance is allowed, but is often flagged as code smell; static methods must be available statically.
, , - . & sect; 8.4.8 :
& hellip;
.
, .
, , :
AWD.isRearWheelDrive()
, , , , , , , false:
interface AWD {
default boolean isRearWheelDrive() {
return false;
}
}
. , , , , -. , , - :
interface HasDriveWheels {
boolean isRearWheelDrive();
}
interface AllWheelDrive extends HasDriveWheels {
@Override
default boolean isRearWheelDrive() {
return false;
}
}