接口没有构造函数,那怎么可以继承呢? [英] Interface does not have constructor, then how can it be inherited?

查看:377
本文介绍了接口没有构造函数,那怎么可以继承呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道子类构造函数通过使用 super(); 来调用超类构造函数。
但是由于接口没有任何构造函数,如何进行继承?

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 place?

推荐答案


但是由于接口没有任何构造函数如何进行继承?

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

简单,一个接口不能有任何实例字段所以没有什么可以构建的。您不能将代码置于接口中(最终还是Java 7),因此无需调用任何内容。

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.

这篇关于接口没有构造函数,那怎么可以继承呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆