Inheritance in java and Superclasses(Object, Class)

前端 未结 7 1587
太阳男子
太阳男子 2020-11-30 11:47

Is java.lang.Object superclass of all the custom class/objects inherited implicitly? I thought java didn\'t support multiple inheritance. The reason I ask is i

7条回答
  •  -上瘾入骨i
    2020-11-30 12:18

    Every class without an explicit superclass inherits from java.lang.Object and every other class inherits from it indirectly because when you go up the inheritance tree, you will finally end at a class without an explicit superclass and then at Object.

    java.lang.Class is the superclass of all class objects (not of all objects!), for example of String.class.

提交回复
热议问题