Subtypes in java
This is not legal with inheritance as Java as a language does not support multiple inheritance.
However, you can do this by implementing multiple interfaces, which is different from multiple inheritance.
So yes, it is possible for you to do this as well, as long as you can check if something is an instance of the interface, but that is not the same as the class type and your diagram will be slightly different from the one you draw.
source to share
is it legal?
Uh-huh. Java does not support multiple inheritance with classes. Only multilevel.
So, A
can not inherit from both B
, and on C
at a time.
See: Multiple inheritance in java and How do Java interfaces mimic multiple inheritance?
source to share