• If there are two parent classes let them be P1 and P2 ad a Child class C1 Class P1{ Class P2{ .............. .............. } } Now for assumption,C1 is a child of both P1 and P2 Class C1 extends P1{ Class C1 extends P2{ ................ ....................... } } sample code for demonstration • Now if m1() method were to be called from Child class , confusion occurs leading to ambiguity as to consider which m1,whether from P1 class or from P2 class
• Hence java does'nt support multiple inheritance with
respect to class
• Conclusion: Multiple Inheritance is not supported with
respect to Classes Case2:Multiple Inheritance is supported with respect to Interfaces
• But in case of interfaces it supports multiple inheritance
with same P1 ad P2 as parent interfaces and C1 as child interfaces,C1 can inherit the P1 and P2.
• Here ambiguity does'nt occur as Interface contains only
declaration and don't deal with implementation
Get to know more about oops by java training
Java Training by Besant technologies
• This program does not have any pre-requisites that you
need to have. Even if you are new to the Programming environment, trainers at Besant Technologies will create a platform wherein, you can enjoy building your developing skills. With Global Authorization THANK YOU