If one class is derived from another that is derived from Object, is that “multiple inheritence”

前端 未结 7 1523
没有蜡笔的小新
没有蜡笔的小新 2021-01-29 09:56

The fact about Java is that it does not support the multiple inheritance.

But I have a question that the base class of all java classes is Object.

Now we have tw

7条回答
  •  旧巷少年郎
    2021-01-29 10:07

    Object class is base class of all other classes.Here when you inherit class B from class A then class B can not be inherit from Object class.

    public class B extends class A
    {
    
    }
    

    And here, base class of class A is Object class.

    So in short, if we not inherit any class then its base class would be object class.

    You can also refer this:

    http://docs.oracle.com/javase/tutorial/java/concepts/inheritance.html

提交回复
热议问题