Pages

Why Multiple inheritance not supported in Java?

Why Multiple inheritance not supported in Java?

  • Consider class A, class B java same method show() and class C extends both class A ,class B.
  • Now at this point Java compiler doesn't know which class method needs to be invoked. It creates an ambiguity to java compiler. So, Multiple inheritances not supported through class.
  • To prevent ambiguity error to java compiler, multiple inheritances can be achieved through interfaces because in interfaces implementation of interface methods is provided in a separate class.
Why java not supports multiple inheritance
Java not supports multiple inheritance


Why java not support multiple inheritance
Multiple inheritance not supported in Java
Please comment below to feedback or ask questions.

No comments:

Post a Comment

Please comment below to feedback or ask questions.