A static method on an interface is called only through the interface's own name; it is never inherited by implementing classes the way a default method is.
interface MathOps {
static int square(int x) { return x * x; }
default int cube(int x) { return x * x * x; }
}
class Impl implements MathOps {}
System.out.println("Static via interface: " + MathOps.square(5));
System.out.println("Default via instance: " + new Impl().cube(3));
Static via interface: 25
Default via instance: 27
Run this yourself in the Online Java Compiler, spin up a live REST API in the API Sandbox, or practise with Java interview questions.
Published 2026-09-27