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

前端 未结 5 659
情话喂你
情话喂你 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:05

    But since interface doesn't have any constructor how can inheritance take place??

    Easy, an interface cannot have any instance fields so there is nothing to construct. You cannot place in code in an interface (up to Java 7 anyway) so there is nothing which needs to be called.

提交回复
热议问题