Classes that don't inherit Object class

前端 未结 4 1178
星月不相逢
星月不相逢 2020-12-03 12:27

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

4条回答
  •  青春惊慌失措
    2020-12-03 12:46

    According to Java Object superclass, java.lang.Object does not extend Object.

    Other than that, all classes, i.e.

    class ClassName {
        //some stuff
    }
    

    implicitly extend Object class, if they don't extend any other super-class.

    Interfaces, on the other hand, do not extend Object, as Interface, by definition, can not extend Class. Also, Interfaces can not contain callable methods, nor can objects be instantiated from them. When interfaces are finally implemented, the implementing class will necessarily extend Object (and, no, Object doesn't implement or extend any other entity/class/interface).

提交回复
热议问题