+ 2
java
what is the diamond problem in java??
1 Respuesta
+ 1
The “diamond problem” is a problem of multiple inheritance of state.
Multiple Inheritance: a class can inherit properties and methods of more than one parent class.
The diamond problem occurs when there exist methods with same signature in both the super classes and subclass. On calling the method, the compiler cannot determine which class method to be called and even on calling which class method gets the priority.
In Java, however, multiple inheritance is not allowed for classes, only for interfaces, and these do not contain state.