不继承Object类的类 [英] Classes that don't inherit Object class

查看:146
本文介绍了不继承Object类的类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何类不继承Object作为SuperClass或者可能已经过时/弃用?

Are there any classes that don't inherit Object as SuperClass or maybe have become Obsolete/deprecated?

推荐答案

根据 Java Object超类 java.lang.Object 不扩展对象

除此之外,所有类别,即

Other than that, all classes i.e.

class ClassName {
    //some stuff
}

如果没有给出其他超类,所有类都隐式扩展Object。

All classes implicitly extend Object if no other superclass is given.

另一方面,接口不扩展Object,但是它们是不能包含可调用的方法,也不能从中实例化对象。当最终实现接口时,实现类必然会扩展Object。 (并且,不,Object不实现接口)

Interfaces, on the other hand, do not extend Object, but they cannot contain invokable methods, nor can objects be instantiated from them. When interfaces are finally implemented, the implementing class will necessarily extend Object. (and, no, Object implements no interfaces)

这篇关于不继承Object类的类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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