Course contentsShow
← Java
Lesson 518 of 2,87012. Abstract Classes and InterfacesFree lesson

Static Methods vs Default Methods: Key Differences

Compare static and default methods in interfaces: static methods are not inherited and serve different purposes.

Static Methods vs Default Methods: Key Differences

You'll learn: How static and default methods in interfaces differ fundamentally in inheritance and purpose.

The Core Distinction

Both static and default methods can have bodies inside interfaces, but they serve entirely different roles:

Default methods are inherited by implementing classes. They provide a default implementation that subclasses can override or use as-is. They're instance methods that work with the object's behavior.

Static methods belong to the interface itself and are not inherited at all. They're utility methods associated with the interface type, called directly on the interface name.

Think of It This Way

Imagine an interface as a job contract:

  • Default methods are like "standard procedures" that every employee inherits and can customize if needed.
  • Static methods are like "company-wide utilities" in the employee handbook—useful, but not part of any individual employee's personal toolkit.

Key Differences at a Glance

AspectDefault MethodsStatic Methods
InheritanceInherited by classesNOT inherited
OverridingCan be overriddenCannot be overridden
AccessThrough object instanceThrough interface name only
PurposeExtend behavior of implementationsProvide helper/utility methods
PolymorphismParticipates in dynamic dispatchNo polymorphism—resolved at compile-time

Why This Matters

When you implement an interface, its default methods become part of your class's API. Static methods don't—they remain tied to the interface itself. You can't call a static interface method through an instance variable, even if that instance's class implements the interface.

Key Takeaway: Default methods are inherited and can be overridden; static methods are not inherited and serve as interface-scoped utilities independent of implementing classes.