Multiple Interface Implementation vs Single Class Inheritance
Fast recall
Quick revision
Core answer
Whether you connect 'multiple interfaces, one class' to the absence of state in interfaces and the diamond problem.
Stating the rule without the reason, or thinking default methods make interfaces as risky as classes.
Explain default-method conflicts are resolvable (override + InterfaceName.super), but conflicting state from multiple classes is not, which is the real blocker.
Interview-ready guide
Interview answer
A Java class extends one class, which keeps one superclass state and constructor chain. It can implement several interfaces because interfaces describe multiple type contracts and do not contribute instance fields or constructors.
For example, ReportService extends BaseService implements Runnable, AutoCloseable combines inherited implementation from one class with two independent contracts. Multiple interfaces can still conflict: if Readable and Previewable both define the same default show() method, the class must override show() and choose or combine the behavior. It can call a particular default with Readable.super.show(). This explicit rule lets a class have several interface types without Java needing to merge state and constructor chains from several parent classes.
Multiple Interface Implementation vs Single Class Inheritance
Direct Answer
Java defines one direct superclass so every class has one class-state and constructor chain. It allows multiple interfaces because interfaces have no constructors or per-instance fields. Interfaces can still conflict—for example, two inherited default methods with the same signature—but Java requires the implementing class to resolve that conflict explicitly.
Code Example
interface Flyer {
default String move() { return "fly"; }
}
interface Swimmer {
default String move() { return "swim"; } // same default method name — clash!
}
class Duck implements Flyer, Swimmer { // implementing many interfaces: OK
// Compiler REQUIRES this override because both parents define move()
@Override
public String move() {
// Explicitly pick a parent's default with InterfaceName.super.method()
return Flyer.super.move() + "/" + Swimmer.super.move(); // "fly/swim"
}
}
// Multiple interfaces — a class playing many roles at once
interface Comparable<T> { int compareTo(T o); }
interface Printable { void print(); }
interface Serializable { } // marker: no methods at all
class Product implements Comparable<Product>, Printable, Serializable {
private String name;
private double price;
Product(String name, double price) {
this.name = name;
this.price = price;
}
@Override public int compareTo(Product other) { return Double.compare(this.price, other.price); }
@Override public void print() { System.out.println(name + " @ " + price); }
}
// This is illegal — Java will not compile it:
// class Duck extends Bird, Fish { } // ERROR: multiple class inheritance not supported
public class Demo {
public static void main(String[] args) {
Duck duck = new Duck();
System.out.println(duck.move()); // fly/swim
Product p = new Product("Laptop", 999.99);
p.print(); // Laptop @ 999.99
}
}
Common Mistakes & Pitfalls
- Stating the rule without the reason — 'a class extends one but implements many' is only the what; interviewers want 'because interfaces carry no instance state,' and stopping short reads as memorization.
- Believing default methods make interfaces as risky as classes — a
defaultmethod clash is resolvable with an override, while conflicting fields from two parent classes are not, which is the actual blocker. - Forgetting how to resolve a default clash — when two interfaces define the same
default, you must override it and callInterfaceName.super.method(); saying 'it just fails' misses the fix interviewers listen for. - Blaming method bodies for the diamond problem — the unsolvable conflict is duplicated state and constructor chains, not the mere existence of method bodies; mislabeling it exposes a shallow grasp.
Check your understanding
Answer these without looking back at the article.
- Can a class both extend a class and implement interfaces?
- What is the syntax to call a specific parent interface's default method?
- What is multiple inheritance of type in Java?
Looking for a structured roadmap?
Every module on this page is also part of the full Java backend interview track.