With out constructor chaining there is no possible of inheritance occurs then how inheritance occurs in interface and multiple inheritance is possible?
2 Answers
Between a class and an interface there is no inheritance, but implementation relationship. Since a class that implements multiple interfaces is actually not inheriting anything them, I don't see any problem. The implementor class doesn't have to invoke constructors because the interface is only a kind of contract: the implementor classes must provide the interface methods.

- 1,661
- 13
- 22
-
Classes *can* now inherit things from interfaces, specifically default methods. – T.J. Crowder May 21 '17 at 17:14
-
Classes inherit everything except static methods from the interfaces they inherit, and always have. This answer is therefore plain wrong. From the JLS: "A class C _inherits_ from its direct superclass and direct superinterfaces all `abstract` and default (§9.4) methods `m` for which all of the following are true: ..." (Emphasis original) – Lew Bloch May 21 '17 at 20:07
You're starting with a false premise:
With out constructor chaining there is no possible of inheritance...
Constructor chaining isn't required for there to be inheritance.
Interfaces have no per-instance state, and no constructors (the fact they don't have per-instance state is essential to their not having constructors). However, they can include
abstract methods (e.g., without implementations), which the class inherits and must either implement or, if it's an abstract class, declare
abstract
default
methods with implementations that are inherited by the implementing class unless the class defines its own implementation
Re default
methods, say you have:
interface TheInterface {
default void answer() {
System.out.println("42");
}
}
class TheClass implements TheInterface {
}
Then you have:
TheClass c = new TheClass();
c.answer(); // Outputs "42"
TheClass
inherits from TheInterface
, both from a type perspective (an instance of TheClass
"is a" TheInterface
) and an implementation perspective (TheClass
inherits the implementation of answer
from TheInterface
). But there is no constructor chaining, because interfaces do not have constructors, because they do not have per-instance state.
You might be tempted to think that there's a no-args constructor that TheClass
calls, but we can see from the bytecode that TheClass
's constructor chains to Object
, not TheInterface
:
javap -c TheClass
:
class TheClass implements TheInterface { TheClass(); Code: 0: aload_0 1: invokespecial #1 // Method java/lang/Object."":()V 4: return }

- 1,031,962
- 187
- 1,923
- 1,875
-
Classes also inherit the abstract methods from their superinterfaces. – Lew Bloch May 21 '17 at 20:12
-
@LewBloch: What do you mean, the signature? I covered that "...from a type perspective." Obviously not the implementation, as there isn't one, by definition. I can clarify that, sure. – T.J. Crowder May 22 '17 at 05:59
-
I'm simply pointing out that the JLS explicitly says that classes inherit abstract and default methods from their superinterfaces. I mean exactly what the JLS means. – Lew Bloch May 22 '17 at 14:12