Inheritance in java and Superclasses(Object, Class)

前端 未结 7 1592
太阳男子
太阳男子 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条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-30 12:19

    Everything is an Object, that said you could see the structure as this:

    Object
    
    Animal
    
    Cat
    

    and not as this:

    Object    Animal
    
          Cat
    

    Where Cat extends both, it's not like this last example, but it's Cat that extends Animal which extends Object.

提交回复
热议问题