我们从Object继承吗? [英] Do we inherit from Object?
问题描述
伙计们我们是否从其他类继承Object(当然除了我们不必明确说明)或者对Object类有一些特殊的权限而且它不像其他类那样继承?
Guys do we inherit from Object like from any other class (except of course that we don't have to explicitly state that) or there is some special privileges to Object class and it's not inherited as other classes?
推荐答案
不一样。这里摘录自 JLS 8.1.3 :
No it's the same. Here the excerpt from JLS 8.1.3:
如果任何其他
类的类声明没有extends子句,则
类具有该类Object
作为
隐式直接超类。
If the class declaration for any other class has no extends clause, then the class has the class
Object
as its implicit direct superclass.
当然, 对象
本身有点特殊( JLS ):
Of course, Object
itself is a bit special (JLS):
每个类除
Object
是
扩展的(即子类)
a单个现有类(§8.1.3)和
可以实现接口(§8.1.4)。
Each class except
Object
is an extension of (that is, a subclass of) a single existing class (§8.1.3) and may implement interfaces (§8.1.4).
这篇关于我们从Object继承吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!