Why Multiple Inheritance is Not Supported in Java

In an white paper titled “Java: an Overview” by James Gosling in February 1995 gives an idea on why multiple inheritance is not supported in Java.

JAVA omits many rarely used, poorly understood, confusing features of C++ that in our experience bring more grief than benefit. This primarily consists of operator overloading (although it does have method overloading), multiple inheritance, and extensive automatic coercions.

Who better than Dr. James Gosling is qualified to make a comment on this. This paragraph gives us an overview and he touches this topic of not supporting multiple-inheritance.

Java does not support multiple inheritance

First lets nail this point. This itself is a point of discussion, whether java supports multiple inheritance or not. Some say, it supports using interface. No. There is no support for multiple inheritance in java. If you do not believe my words, read the above paragraph again and those are words of the father of Java.

This story of supporting multiple inheritance using interface is what we developers cooked up. Interface gives flexibility than concrete classes and we have option to implement multiple interface using single class. This is by agreement we are adhering to two blueprints to create a class.

This is trying to get closer to multiple inheritance. What we do is implement multiple interface, here we are not extending (inheriting) anything. The implementing class is the one that is going to add the properties and behavior. It is not getting the implementation free from the parent classes. I would simply say, there is no support for multiple inheritance in java.

Multiple Inheritance

Multiple inheritance is where we inherit the properties and behavior of multiple classes to a single class. C++, Common Lisp, are some popular languages that support multiple inheritance.

Multiple Inheritance

Why Java does not support multiple inheritance?

Now we are sure that there is no support for multiple inheritance in java. But why? This is a design decision taken by the creators of java. The keyword is simplicity and rare use.


I want to share the definition for java given by James Gosling.

JAVA: A simple, object oriented, distributed, interpreted, robust, secure, architecture neutral, portable, high performance, multithreaded, dynamic language.

Look at the beauty of this definition for java. This should be the definition for a modern software language. What is the first characteristic in the language definition? It is simple.

Ads by Google

In order to enforce simplicity should be the main reason for omitting multiple inheritance. For instance, we can consider diamond problem of multiple inheritance.

Diamond Problem of Multiple Inheritance

We have two classes B and C inheriting from A. Assume that B and C are overriding an inherited method and they provide their own implementation. Now D inherits from both B and C doing multiple inheritance. D should inherit that overridden method, which overridden method will be used? Will it be from B or C? Here we have an ambiguity.

In C++ there is a possibility to get into this trap though it provides alternates to solve this. In java this can never occur as there is no multiple inheritance. Here even if two interfaces are going to have same method, the implementing class will have only one method and that too will be done by the implementer. Dynamic loading of classes makes the implementation of multiple inheritance difficult.

Rarely Used

We have been using java for long now. How many times have we faced a situation where we are stranded and facing the wall because of the lack of support for multiple inheritance in java? With my personal experience I don’t remember even once. Since it is rarely required, multiple inheritance can be safely omitted considering the complexity it has for implementation. It is not worth the hassle and the path of simplicity is chosen.

Even if it is required it can be substituted with alternate design. So it is possible to live without multiple inheritance without any issues and that is also one reason.

My opinion on this is, omitting support for multiple inheritance in java is not a flaw and it is good for the implementers.

This Core Java tutorial was added on 24/09/2012.



Comments on “Why Multiple Inheritance is Not Supported in Java”

  1. Nice article and good reasoning.

    • Anonymous

      Its a good article.. Nadig

    • rggreg

      It should read common lisp, not common list. Also, scala support mixin composition which is not exactly same as multiple inheritence.

      And why could not java have been designed to support multiple inheritence?

      We could say D extends C, B – make sure super calls line up properly!

      Not at all a good explaination for :


      • Joe

        I have fixed the typo (list to lisp), thanks for helping out.

        Scala’s support for multiple inheritance – I read online as “a flexible mixin-based composition mechanism as a clean replacement for multiple inheritance”, so I included it in the list. Looks like it can be misleading, so I have removed it now.

        I felt, I have given a clean and complete explanation for why java is not supporting multiple inheritance. If you feel otherwise, can you add your point of view to help.

        • Serg

          Actually you could workaround on this limitation in Java too.
          For example external class extends one class, and it’s internal class extends another (or couple of).
          It is not exactly “multiply inheritance” but works quite similar allowing to reuse methods implementations from two or more superclasses. It sounds like Scala multiple inheritance support “a flexible mixin-based composition mechanism as a clean replacement for multiple inheritance” description fits such design. )

      • sam

        well ofcourse super(s) can be placed in their proper positions, but the thing is people forget. it’s the same reason why servlet’s parameterised init method is depreciated not.

    • Achuta Barada

      Thanks ….
      Actually i came to know the Root Cause Behind this…
      and also first time i learn the Ne term “Dimond Problem “…..

      Keep on Posting……..

      Good Explanation………

    • sangram

      how we can explain it theoritically?

    • Mangesh Nakhate

      Nice Article

    • hemanth

      multiple inheretance meansone subclass and two super class
      unfortunatly two parents are not excuted in same function with different inmplementations due to sub class is getting cconfused in inheretence time hemce unable to compail

  2. Sudheer Verma

    nice explaanation of “Deadly diamond condition” through visual

  3. Vatu

    Simply Superb…………

  4. Anonymous

    Nice expalnation.. very easy to understand

  5. Abhishek Anne

    Is there any work-around for situation while implementing multiple interfaces have methods with same signature?

  6. Thiyagarajan

    simply superb

  7. Abhishek

    nice 1 keep posting article like this

  8. Anonymous

    Nice Job Kulandai… !!!!! I am you fan!!!!

  9. Manishkumar Modi

    Nice Joe.
    Can you please write blog on volatile in java with example.

  10. This article looks simple but it is an advance concept to discuss . And joe just explain it beautifully .

    Specially reference of Dr. Goslings about java.
    Thanks to contribute to community with some great articles .This is first time i am reading from a specific site regularly and subscribed .

  11. Jim

    Huh, I’m confused. Everything I read said inheritance was a good thing.

  12. amy

    worth reading…one can easily get the concept because of diagrams used in it… thanks

  13. vadhiraju

    very nice..

  14. swarna

    crystal clear

  15. Leo

    hi Joe,

    My opinion about interface is just a check list in java.For example if u implement any interface for a class u must implement all methods in interface u declared.

    What is the use of using interface?
    Instead of declaring it separately in interface.we can declare directly in class itself..

    please let me know answers for the questions..

    • Joe

      In simple terms, imagine we are going to build a colony of houses and we want all the houses to look similar.

      We will create a blueprint plan and use the same plan for all the individual houses.

      Here blueprint is the interface and individual houses are the concrete classes that will implement the interface.

      • sarwan

        and the interface has oly the blueprint(i mean the methods), the conrete classes which implements that interface can have different definitions r8???
        Correct me if im wrong….

    • Pranav

      Hey, I would like to Post one more example here..
      There are various motor-car producing company.
      Cars produced by each and every company has wheels and breaks.

      All the company is implementing an interface, let’s say “Car” and the vehicle they produce is a concrete class.
      No matter what kind of wheels and breaks they provide, but they need to provide it compulsorily.

      When a class implements an interface, it adheres an agreement that it will provide the implementation of that interface…


    Nice explanation sir.But Multiple Inhertance means implementing some multiple properties.Interface also help to implement many property at same class..It cant to say class property or method property.it simply take “property”.

  17. Arvind

    yes i agree ,

    This topic compel me to think about the inheritance. How do you think about the composition in java?

    Which is better way to reuse the things as far as the design and performance is concern inheritance or composition?

    • Joe

      Prefer composition over inheritance as it is more flexible. Flexible in the sense, in composition we can use DI (dependency injection), but with inheritance the relationship is tightly coupled.

  18. Arvind

    Sir if u get some time then please discuss about.

    Why we have compiler and interpreter in java and other questions like:-

    1. Why we have two system software if both can be equally capable of doing the things like both converts a computer language one level to another.

    2. If both system software is there in lots of languages like java, then it means there is something that can’t be achieved by other one . what is that?

    3. And the last but not the least a programming language is created first or its compiler or simultaneously tell me .

    • usha

      hey java is platform independent. it doesn rely on any platforms like linux,solaris.because jvm interprets everything so no need of conversion from one language to other.

      when ever u write a code in java while saving u give as .java but after compilation it becomes .class file.

  19. Anonymous

    nice explanation……Thanx

  20. Raj Saini

    Very Nice Explanation ……

  21. Anonymous

    Good Explanation Joe……..

  22. Shalin

    I want to know one thing that how multiple inheritance is handled in C++?
    In our example which method will be used from Class B or C???
    And why it is crappy sometimes?

  23. Ankit

    Really Nice!!! :)

  24. +1 to the explanation..!!

  25. Nick

    Missing the point.

    1. Interfaces are inheritance of interface, but not the inheritance of implementation.

    2. MI is very useful, because you can mixin implementation.

    3. MI is hard to implement if you have dynamic loading of classes.

    It’s point 3 for the simple reason why it was left out. Think about how dispatch is handled, to see why.

    4. C++ is awful at MI.

    That’s the reason for arguments that you make. C++ is bad at MI, so MI must be bad. That’s the usual argument.

    So what’s a good implementation?

    See Eiffel, and how its dispatch mechanism works, or Python for an interpreted example.

  26. Tuhin

    Thats why I like this blog….hard things seem so simple here……it’s like a flow when reading the article….and I can’t stop reading till it ends…..

    Thanks Joe

  27. Joe


    Thanks for the comment. I have rephrased some sentences to emphasize the right point.

  28. Radhika


    Constants declared in interfaces are inherited to implemented classes.So there is inheritance through interfaces. Am I right?

  29. rakesh kumar

    In Synchronize static method JVM block the Class then what is its meaning.What is its basic need?Why we do it……..?

  30. Anonymous

    I think Gosling took the multiple inheritance out of context. Different programmers have their different views on how to confront a certain issue. What just Gosling exposed is that he has given up his hope and abandoned the language for which he forever loves most- C++.

  31. Praveen J

    Thanks for your In-depth clarification of multiple inheritance. Usually I used to concentrate only on definitions but here its something special in your blog.

    Still it would be better to have a separate blog on INTERFACE with its needs, purpose and the right place to use it.

    Waiting for that….

  32. SrinivasaraoVanapalli

    Nice Explanation

  33. Vijay

    It was a good presentation. Thank You Joe!

  34. suresh

    good explanation on multiple inheritance.

  35. Sarath Kumar N

    Superb Awesome……………….. U rock JOE>>>>>>>>>>>>>>>>>>>>

  36. Balaji Reddy

    Nice Explanation

  37. Amit Singh

    good explanation but we want some additional explanation related to coding’s point of view that may help us for further processing………

  38. Anonymous

    Thanks and good website to get deep understanding of Java

  39. Anonymous

    Why Scala can do this?

  40. Sumit Singh

    Impressive words used here not even bored for a second.I hope i will get here my solution in
    satisfied manner.

  41. Jack9

    Almost every modern language now has a method for multiple inheritance. The diamond problem was never “a problem”…as there is always an order of declaration that can act as the precedence identification. Z.toString, A.toString and B.toString, Z extends A,B, B.toString is the second and final override.

    The idea that multiple inheritance is rarely used is simply untrue. Java has an entire set of metalanguages to deal with this mess (AOP). Opinions being valued over Computer Science started really becoming the norm in the 90′s with these backward decisions on design. Now JVMs would have to be redone to fix this mess.

  42. Akhil

    Thanks Joe for such a nice explanation.

    Interface contain the methods which are implemented by the classes.
    When each class is having its own separate implementation for the methods what is the exact use of having Interface.Cant we directly
    declare and implement the method in the class itself?

  43. Shubha

    Very good explination..

  44. Sultan

    Hey joy! nice reasoning, really we can live without multiple inheritance. The thing is that actually multiple inheritance confuses both the programmer and tester and “deadly diamond situation” is a great example of it. Particularly in the case of overridden methods (if java allows multiple inheritance) which class’s method should be overridden is really gives rise to deadlock( mean to say deadly diamond situation). But, however we can survive without multiple inheritance and if necessary we have interfaces to achieve our desired results, so I also agree with you that ” not supporting multiple inheritance is not a flaw in Java programming language”.

    PS: the figure explaining multiple inheritance(heavenly horse inheriting wings from eagle and horse features from ancestors) is really beyond expectations…!

  45. saravana

    nice one

  46. Anonymous

    Hi Joe,

    My humble suggestion on your blog is that we can not supremely rule out the issue that Java does not support multiple inheritance. Because, we defer the implementation of the interface methods to the subclass which implements that interface. The interface not only contains methods but some properties too (in the form of public static final ). In this context, the class which implements the interface, it automatically inherit the properties as well as the behaviour from the interface. Just imagine a class extends some abstract class(which contains some properties and abstract methods) and implements some interface (which contains some properties and abstract methods). In this case, the subclass has all properties and behaviours of both the abstract class and the interface. Hence, my point of emphasis is that, we java provides the multiple inheritance support indirectly and it does not nullify the issue, what ever the reason we avoid the multiple inheritance.


    • pradeep kumar

      rightly said and we cant say that interface members are not inherited to the class which is implementing this interface.variable are inherited to the subclass.

  47. Pradeep

    Really superb presentation.Keep this spirit!!!

  48. Ragupathirajan


    Could you please explain about ThreadPoolExecutor in your usual way. Thanks in advance


    nice explanation.

  50. Arjuncc

    This is well written.

  51. ambru

    simply subprrr….

  52. someone

    great explanation! Thanks for this awesome write-up..

  53. Shiv

    Can an interface extend two interfaces?
    Eg: interface A extends B,C{


  54. basant joshi (B,J)

    Right I am Agree with you sir .
    Another region is inheritance is totally based on object but in interface we can not create an object of interface so we can’t say that .
    thanks sir .

  55. nizam

    there is no vitual keyword in java to stop duplicacy of function so there is no multile inheritance occur in java in my opinion

  56. Abrar Ahmed

    what is the alternate solution for Multiple inheritance in JAVA?

  57. krishnamurthy

    interface A{
    public void m1();
    interface B{
    public void m1();

    public class InterfaceTest implements A,B{
    public void m1(){
    public static void main(String[] args) {
    InterfaceTest it=new InterfaceTest();

    Could you please explaine while call this method which method will call.

    • Anonymous

      A a1=new I1();
      a1.m1();now its call method available in interfaceA

      B b1=new I1();
      ;now its call method available in interfaceB

      • Anwar

        A a1=InterfaceTest();
        a1.m1();now its call method available in interfaceA

        B b1=new InterfaceTest();
        ;now its call method available in interfaceB

    • ramakrishna

      interface A
      public void m1();
      interface B
      public void m1();

      public class InterfaceTest implements A,B
      public void m1(){
      public static void main(String[] args) {
      InterfaceTest it=new InterfaceTest();
      A a=new InterfaceTest();
      B b=new InterfaceTest();

      so this would gives my clarity to u r question it depends
      on which object is being created first and assigning of reference to

      • shakeel

        please explain me clearly what happens when you write B b=new interfacetest();internally how it works…

  58. Anonymous

    good…Can u tell me the difference between Access Modifiers and Access specifiers?

  59. Jb

    nice explanation, my opinion, down arrow instead of up arrow will exactly express the inheritance.

  60. sravani

    Nice article and good understanding

  61. Jobin

    Hi Joe,
    Every class inherits an object class. So when one class acquires the properties of another class it also acquires the properties of the object class. Multiple Inheritance is already happening there. So what’s the point in saying Java does not support Multiple Inheritance.

    • Om

      Multiple Inheritance is the concept of a single class inheriting from two or more super classes. If a class inherits from a super class and if that super class inherits from another super class it does NOT qualify as Multiple Inheritance. It is still Single Inheritance.

      It is true that every class in Java inherits from the Object class – either indirectly or directly.

      Class Sparrow inherits from class Bird and class Bird in turn inherits from class Animal, which in turn inherits from Object. This is still Single Inheritance. It will be Multiple Inheritance if the Sparrow class inherits from another class Flier along with inheriting from the Bird class. Hope it helps.

    • ramakrishna

      in dealing with inheritanc we should concentrate on creation of object to super class to for example

      public class superclass {
      System.out.println(“constuctor create means object created”);
      public void a()
      System.out.println(“a of superclass”);


      the sub class would only extend if and only if it does not extend any other class
      once u create object of sub class the object hierachy would be create on order of objectclaass–>superclass—>subclass;
      public class subclass extends superclass{
      int a=99;
      subclass(int a)

      superclass s;
      public void a()
      System.out.println(“this is funa of subclass”);
      public static void main(String[] args)
      subclass s=new subclass(2);



    • merul shah

      hey jobin, wht eg u gave is the example of multilevel inheritance…

  62. rakesh kumar

    why we keep ‘final’ of Interface data member…? please give me reason !

  63. Sudha

    Nice explanation!

  64. Harsh

    Thanks Joe! This is a really nice post.

  65. Arun

    Very Nice Explanation !!!

  66. nice article,

    it has cleared much more about Inheritance.


  67. deepak

    hi it’s nice article , i also went through White paper it says
    “Multiple inheritance—and all the problems it generates—was discarded from
    Java. The desirable features of multiple inheritance are provided by
    interfaces—conceptually similar to Objective C protocols.”……. why cant we say that

  68. Kiran

    Awesome article and beautiful comments.
    I teach lot of things from this article and comments..

  69. mansa

    nice article…and explanation is very good

  70. Anonymous

    simply say

  71. ash

    very interesting… there cant be a better explanation for this… thanx

  72. Balaji

    Very nice explanation

  73. @ramesh

    nice explanation…

  74. K Shiv

    interface A{
    public void ABC();
    interface B{
    public void ABC();
    public class Example implements A,B{
    public void ABC(){
    // implementation of ABC
    p s v m(String…){
    Example e = new Example();
    e.ABC();//if we implement and call the //method, now this method reference to which //interface, I mean how the jvm invokes the method call ?

  75. Yash

    Thanku joy vr\ery good concept ….i was eaasily understand….

  76. pavan

    really a worth reading it…
    nice explanation …

  77. this is awsomeeeee

  78. kalai


  79. senthil

    nice article..keep posting this kind of article in java..thanks so much

  80. Gayathri Chitnhala

    Awesome explanation.
    Nice articles. Please publish a complete book with all of your articles.

  81. Muthusamy

    Hi Joseph,

    Instead of avoiding the multiple inheritence altogether, the java specification could have provided a solution for this multiple inheritence implementation issue. One solution, I could think is, the compiler can add a restriction to redefine the method if it is being defined in more than one parent (Base) classes. Inside the redefinition, the subclass can call one of the base class definition.


  82. Manzar Baig

    What ever it is so it is. I appreciate your effort to make programmers clear their concepts. I just want to add one thing, and please correct me if I am wrong. We all know ‘Multiple’ means more than one ‘Inheritance’ means adopting attributes and characteristics from parent. In java if A extends B it means A acquires all(I dont want to discuss what can not be) the characteristics of Class B. So B is one parent of A (single inheritance). But by default another parent of A is Object class. So from A’s perspective it has two parents B and Object. Is it not a contradiction with the statement that Java does not support multiple inheritance.

    • ramakrishna

      object class would extended in conditions like if it does nt extend any class the defalutly it would not be extended

  83. anand

    Nice article and good reasoning.
    thank you sir.

  84. Gopal Bhoyar

    I am new to the java programming but I understud all above about multiple inheritence. it is very interesting.thnx a lot.

  85. Varun

    Nice explanation..

  86. jagadeesh

    finally i understand this concept,,thanks a lot,smart explanation

  87. Very nice.. I understood the concept clearly. Thanks a lot.

  88. albi jegan

    what is diff b/w abstract and interface based on the usage and not based on syntax ?

    why we use interface,because already over abstract?(the same functionality done by abstract)

  89. Anonymous

    thank u so much i was wandering for this type of explanation :)

  90. Radha

    very nice explanation.. superlike :-)

  91. raj

    Very Well explained. Thanks a lot. Keep posting

  92. perfect explaination sir.:)

  93. I agree with most of your point. What ever the reason are but i consider it as weakness of Java. As it works well in other some language

  94. Nagaraju Gurram


  95. mukesh

    Hi joe,
    the implementing class will have only one method and that too will be done by the implementer.

    which class it will be can you provide me some more explanation for these lines

  96. rana

    blog and it content super…….

  97. Nupur

    Very nice explanation. Thanks.

  98. lalit

    sir give me guidance plz i am pursuing MCA last semester and i have decide e-shopping project on J2EE so give me guidance how to online payment facility implement or your suggestion give me sir……Lalit

  99. gangasani mahesh reddy

    excellent and nicely explained thank you

  100. Anonymous

    very nice answer..

  101. Sandy

    Explained in a simple manner. Very nice

  102. PMJ

    Java Supports Multiple Inheritance.
    But, But in restricted sense – Single Concrete super-type and multiple “interface only” super-type.

    Where as in language like C++, multiple concrete super-type.

    This restriction, enables java to get away with most problems of multiple inheritance.

  103. Anonymous

    Excellent Example

  104. this.Ankur

    By default every class in java inherits Object class, then how can one say that java does not support multiple inheritance?

    class A{
    //implicitly inherits Object Class

    class B extends A{
    //implicitly inherits A, Object class too??

    Please Help.

  105. MSR707

    Can you post a blog on ‘context’ in java? What exactly it is? We use it in servlet,android ,ejb

  106. tapu ranjan

    Hi joe,
    Today actually i came to know about the concept behind why multiple inheritance is not supported by java…u r superb

    Tapu Ranjan

  107. I like your papers.


  108. Anonymous

    I always Google, when i am in doubt and you papers are the first thing that shows up


  109. Really nice post sir,,,
    i like your site i always use for reference.
    thanks to you to increase my knowledge…

  110. Rajashekhar

    simply superb…….. i like your site very much.

  111. i haven’t understood this means. u made
    me confused alot.please make understood .

    How multipale inheritance is not possible in
    java ?

  112. Rohit Kumar Prusty

    Nice explanation..

  113. Rajesh

    This is really an amazing post and came to know that why java does not support Multiple inheritance…. Keep Posting you are doing a great work……..

  114. Dinesh

    Very clear explanation. we can’t get the method implementation of those interfaces. So it proves java does not support multiple inheritance. Thanks Joe

  115. sivaurbozz

    Good explanation…

  116. Waleed

    Many thanks, I really appreciate it, a well-chosen article and content.

    Waleed, UAE

  117. abhishek

    Hi Joe,

    As we all know java does not support multiple inheritance,but provides a useful way of Interface.
    All the explanation which i got is related to methods not about the data member in this regard.

    Following example denotes this.

    public interface TempIntfA {
    public static int MAX=10;


    public interface TempIntfB {
    public static int MAX=20;
    public class ClsImplIntf implements TempIntfA,TempIntfB{

    public static void main(String a[])
    ClsImplIntf c=new ClsImplIntf ();
    int c2=c.MAX;

    the line gives the compilation error that “The field c.MAX is ambiguous.”

    with this can i say that “java support multiple inheritance through interface in case of methods but not in case of data members”


  118. Jaywant Patil Java Developer

    Very clear explanation.
    This is really an amazing explaination and came to know that why java does not support Multiple inheritance…. Keep Posting you are doing a good work…….

    Thanks & Regards
    Jaywant Patil

  119. Anonymous

    Awesome explanation dude…,
    Got what I needed. Thanks bro.

  120. Mazhar

    This article is very useful. Thanks

  121. Basha

    Clear explanation…

  122. Anonymous

    Let me know when to use interface and when to use abstract class

  123. Debjit karmakar

    easy defination for multiple inheritance

  124. Sateesh

    Man.. You rock… :-) !!

  125. Arun


    Your example for the justification looks good.
    But we can create a obj for D class, and any one or both methods can be implemented.
    that can be accessed by differentiating parameters.

    Is it so?

  126. Saifuddin Syed

    Totally thanks to you for this article…
    There are many reasoning in the world of internet but this was the ideal way to understand this reasoning that why multiple inheritance is not included in java..

    Just as the definition of java…

  127. An awesome example of bird and horse.
    Will like to see more on java.
    Thanks one again for clearing my concept of the Multiple inheritance.

  128. Saikumar

    Hi joe,

    I want to know something about inner and nested classes please give me a best explanation of those ,

    Thanks in advance

  129. Simmi Arora

    it was very satisfiable .. thnkew for removing my cnfusion..

  130. Balu Nehe

    I want to ask one question to Mr. Joe sir ,
    that why we can not create the object of Abstract class ?

  131. Balu Nehe

    after handling exception can we again start the execution of programme ?

  132. Hi Joe,

    Even I agree with your view that omission of Multiple inheritance is for our good only in order to avoid confusion. You have explained it well with an apt analogy..

  133. anil

    one reason for java does not support multiple inheritance is that because of multiple inheritance root object is created multiple times which is wrong and also some variable and method present in the same object with same priorities which leads jvm enter into the state of ambiguity.

  134. Anonymous

    its nice explanation


  135. sadesh

    Nice Article. The valuable content is presented in the simple way. Kudos!

  136. vinoth

    it’iiiiii It’s a superb article

  137. Dhiren

    good article. nice way to explain.

  138. samir

    good explantion of multiple inheritance .how we can expain with teory bases .how we can debate that there is not supported in java explain.

  139. Iranna Yalavatti

    Nice article

  140. Anonymous

    nice explanation

  141. Gopinath

    nice article:)

  142. DineshKumar

    Hope.Nobody will not struck with this question for upcoming interviews, who has open this blog.

  143. Anonymous

    Multiple Inheritence is possible in java by Interfaces

  144. shekhar

    Hi joe

    It’s pleasure to read such explanation. It’s
    Really very good article.

  145. satish

    nice article.

    Thanks for the clear explanation by taking the James Gosling’s words.

  146. Ghanshyam

    This is very nice explanation dear,
    it really interesting and meaningful one..

    Thanks for sharing..

  147. Anonymous

    Nice explanation…

  148. Naman

    Thanks a lot,

    Really worth reading it.

  149. Avishek

    Thanks a lot! :)

    But is it just because of simplicity that it was committed or it is because of some features which java may not have supported? In C++ we use “::” for resolving ambiguity.. I know it may sound strange, but why didn’t they give this feature?


  150. Sudhir S Dhekane

    Hi Joe,
    Best clarification of, Why java does not support or not at all need such kinds of ambiguous implementations…So No confusion..i.e. its a real beauty and simplicity of java..

  151. Rangareddy Julakanti

    class b{



    class c
    //if supports multiple inheritance
    class d extends b,c
    /** in the above statement is confusion occurred which class constructor will call either class b or class c so thats why java doesnt support**/

    • Ashesh


      I think if you revisit constructor calling hierarchy that would answer your question.

      When we instantiate a class it first call constructor of its super class before executing its own constructor.

      In your example, JVM would not be able to identify the super class constructor which needs to be called when you create object of class D.

    • Sree

      yes boss exactly correct

  152. Shinod

    Interface A {
    int i=10;
    Interface B {
    int j=20;

    Class C implements A, B {

    public static void main(String s[]) {

    My doubt is, can we say that there is no multiple inheritance(even a partial MI) in this situation.

  153. srinixx13

    Joe Nice explanation. But imho for getting more polymorphism i.e the flexibility of both the compositon and flexibility of polymorphism in one design is a good design principle. I think in those days to make java simple than C++ which of course complex which justify the name of the Java definition they have made interface inheritance. But for implementation inheritance now I think there should be some workaround.

  154. George

    i have a doubt!!!!
    a java class extends Object as default….r8…then if we extends another class its multiple inheritance r8….

    is it r8 or wrong please give me an answer

  155. hI, in multiple inheritance compiler wont compare any methods of classes. it will thrown error because of constructor . why because compiler will create default constructor to class automatically so, it will confuse initially to which class it has to create constructor. there we will get ambiguity ….


  156. Sree

    hI, in multiple inheritance compiler wont compare any methods of classes. it will thrown error because of constructor . why because compiler will create default constructor to class automatically so, it will confuse initially to which class it has to create constructor. there we will get ambiguity ….


  157. Chandan

    May be it is time to say till Java 7. With JDK 8, default functions coming into interfaces, what do you think?

  158. Anonymous

    nice …….

  159. Manivannan

    nice …….

  160. Abhijeet

    Really helpfull blog for the people who are little bit confusing about the why java dosen’t support multiple inheritance.

  161. yashodhan

    java not support multiple inheritance…but i don’t understand the java.lang.object. class which is the root class of every class.

    Now, my Question is: Class A base class of Object class and also the Class B….? this is the multiple inheritance

  162. Mark

    Most languages are adding support for multiple inheritance, including Java in Java 8. Conceptually, single inheritance is simpler at the cost of making the overall program harder and more verbose to express.

    The diamond problem is simple to resolve. See Eiffel, Scala and Haskell for how useful multiple inheritance is.

    I think your claim that multiple inheritance is rarely used is a poor one. In java MI is banned, so developers don’t realise when they actually need MI. They work around it by reimplementing MI using composition at the cost of extra code and defects.

    I think you could learn alot by learning more fundamentals of computer science, rather than being Java focussed.

  163. Anonymous

    simple and clear.. thanx for such a nice explanation

  164. swapnak

    nice explanation..really got ur message

  165. sundhar

    Thanks, it is very useful.

  166. Jayant

    “Dynamic loading of classes makes the implementation of multiple inheritance difficult”
    Please expalin me this..

  167. Kumar Bhatia

    Create a nice post on Java Pass by reference and Pass by value – http://javacodeimpl.blogspot.in/2013/12/java-pass-by-value-or-pass-by-reference.html

  168. its very nice explanation and its very usefull to me and example picture are good easy to understand also thanks

  169. comer

    The argument is quite weak actually. “…rarely used, poorly understood, confusing…” – is an example of a qualifying statement without any proof or basis – just an opinion that is “supposed” to be taken as gospel.
    Is it an excuse to stay ignorant? Is it akin to “don’t use the hammer because you will hit your head with it”? Rediculous.
    The diamond “problem” is so easy to avoid – it’s not even worth a discussion. The key is that it is resolved at _compile_ time, where it is most appropriate to give an error if it’s ambiguous. Done. Before saying “Nooo..” try adding the same-named constant to two idependent interfaces, implement them both by the same class and reference the constant. Got it? There you go. Why not do the same for multiple inheritance? Just in case you still don’;t get it:

    interface A {
    public static final int i = 0;

    interface B {
    public static final int i = 1;

    class C implements A,B {
    int a() {
    return i;

    C.java:xx: reference to i is ambiguous, both variable i in A and variable i in B match
    return i;
    1 error

    What about implementing everything just once? Try that with this:

    abstract class A {
    private int a;

    public int getA() { return a; }

    abstract class B {
    private int b;

    public int getB() { return b; }

    // needs both “a” and “b”
    class C extends A,B {
    // ??? ether this or you have to RE-IMPLEMENT

    Copy/paste anyone?

  170. Why exactly multiple inheritance not supported ?
    given as supported interfaces………… y

  171. Baskar


    It is nice article on Multiple Inheritance. you have images to explain and it is very easy to understand. But then what is the use of Interface in java?. i suppose, we use interface to achieve multiple inheritance. Can you clearly explain about that?


  172. Anonymous

    great explanation…so simple like JAVA …:)

  173. Sai Teja Reddy

    THis IS a Great Aricle AND Great discussions are discussing over this website
    ThAnks for the information

  174. sakthi

    first of all i like to say thank you to clarified my doubts in java

  175. tushar mehta

    we have implemented multiple inheritance using interface

    class first2

    int a=10;
    interface first3

    int b=12;

    class first1 extends first2 implements first3
    int j=3;

    class first
    public static void main(String args[])
    first1 ob = new first1();
    System.out.println(“j :”+ ob.j + ” a: ” +ob.a + ” b : “+ob.b);


  176. Thank you! Really nicely explained.

  177. deepak

    nice explanation. very easy to understand.
    Thanks sir

  178. Sagaya

    Its a good one. Made me agree to all the points

  179. anki

    what is the difference between below declarations

    abstract class A{
    abstract void m1();
    interface I1{
    void m1();

Your Comment