Interface does not have constructor, then how can it be inherited?

前端 未结 5 660
情话喂你
情话喂你 2021-01-24 19:43

As I know the subclass constructor calls the super class constructor by using super();. But since interface doesn\'t have any constructor, how can inheritance take

5条回答
  •  旧巷少年郎
    2021-01-24 20:06

    The interface is a contract, defining what methods mush be offered by the implementation. A class doesn't inherit an interface but implements it.

    From the specification :

    This type has no implementation, but otherwise unrelated classes can implement it by providing implementations for its abstract methods.

提交回复
热议问题