I found these statements in a mock exam:
- Multiple inheritance of state includes ability to inherit instance methods from multiple classes.
- Multiple inheritance of state includes ability to inherit instance fields from multiple classes.
- Multiple inheritance of type includes ability to implement multiple interfaces and/or ability to extend from multiple clases.
They are true.
Explanation
Interfaces, classes, and enums are all "types". Java allows a class to implement multiple interfaces. In this way, Java supports multiple inheritance of types.
"State", on the other hand, is represented by instance fields and instance methods. Only a class can have instance fields/methods and therefore, only a class can have a state. (Fields defined in an interface are always implicitly static, even if you don't specify the keyword static explicitly. Therefore, an interface does not have any state.) Since a class is allowed to extend only from one class at the most, it can inherit only one state. Thus, Java does not support multiple inheritance of state.
I understand the explanation, but I do not understand why the first two statements are true.