I've been doing some studying on the types of inheritance. From what I've learned:
- Single inheritance refers to when a class inherits another class.
- Multi-level inheritance refers to when a class inherits another class that inherits another class, etc.
- Hierarchical inheritances refers to when a super-class that has many sub-classes.
Say you wanted to have B
inherit from A
. In Java, all classes are ultimately inherited from the Object
class. Therefore, A -> B
becomes Object -> A -> B
.
Now since A
inherits Object
and Object
has many sub classes, is it safe to say that A -> B
is single or hierarchical inheritance? Can you have "true" single inheritance in Java?
Object
matter toA -> B
, as opposed to e.g.Object
only being inherited byA
? It doesn't, as far as I'm aware, which is why your questions doesn't make much sense (to me). But to answer your question, we need to know precisely what you're trying to point out and why you think that is (or isn't) a problem or meaningful distinction.interface
qualifies as class for those definitions, or not.final
class that inherits fromObject
. That former class is an example of single inheritance. But then you mark an answer that talks about single vs multi inheritance as correct, despite that being completely unrelated to what you appear to be asking in your question. So I now feel that this question is confused and confusing and thus doesn't add value to the site. Voting to close it therefore.