- 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.
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.
I found a thread on Enthuware where Paul says it is correct.
I don't like the question because Java doesn't support multiple inheritance of state. (as the explanation notes). So it isn't something you need to know in the first place for the exam. If Java did allow multiple inheritance of classes, then these statements would be true.
Back to what Java does support - remember that interfaces can declare concrete methods in Java 8. So you can inherit default methods from multiple interfaces.
The explanation and answers are based on this official tutorial:
The Java programming language supports multiple inheritance of type, which is the ability of a class to implement more than one interface. An object can have multiple types: the type of its own class and the types of all the interfaces that the class implements.
The option does not say that java suppprts multiple inheritance of state .