Since Java , interfaces can also contain static methods. A static method in an interface belongs to the interface itself, not to any implementing class. You call it using the interface name.
interface MathUtils {
static int square(int n) {
return n * n;
}
}
// Calling it:
int result = MathUtils.square(5);
Unlike default methods, static methods are not inherited by implementing classes. You cannot call MathUtils.square() through an object reference or a subtype name. This makes static interface methods a good place for helper functions that relate to the interface's purpose but don't need polymorphic dispatch.