Home > Software > Java > Core-Java
Interview Questions   Tutorials   Discussions   Programs   

Core-Java - Why java does not support multiple inheritance?




265
views
asked marvit August 27, 2014 05:41 AM  

Why java does not support multiple inheritance?


           

1 Answers



 
answered By Madhumathi   0  
Java doesnt support multiple inheritance because of the diamond problem . Java is a language which makes things simple . C++ supports multiple inheritance . Multiple inheritance creates ambiguity . 

For ex:
           class A { } 

          class B extends A{ } 
         
          class C extends A { } 
          
          class D extends B , C  { }   X This creates ambiguity , from which class the methods of A should be called .
flag   
   add comment

Your answer

Join with account you already have

FF

Preview


Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!

Alert