{"id":25528072,"date":"2022-06-12T01:49:30","date_gmt":"2022-06-11T20:19:30","guid":{"rendered":"https:\/\/entri.app\/blog\/?p=25528072"},"modified":"2022-11-19T18:00:45","modified_gmt":"2022-11-19T12:30:45","slug":"the-problems-of-multiple-inheritance-in-java","status":"publish","type":"post","link":"https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/","title":{"rendered":"The Problems Of Multiple Inheritance In Java"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_79_2 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-69e74747a2f69\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69e74747a2f69\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/#Terms_used_in_Inheritance\" >Terms used in Inheritance<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/#Types_of_inheritance_in_java\" >Types of inheritance in java<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/#Single_Inheritance\" >Single Inheritance\u00a0<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/#Multilevel_Inheritance\" >Multilevel Inheritance\u00a0<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/#Hierarchical_Inheritance\" >Hierarchical Inheritance\u00a0<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/#Multiple_Inheritance\" >Multiple Inheritance<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/#Multiple_Inheritance_with_Interfaces\" >Multiple Inheritance with Interfaces<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/#Why_multiple_inheritance_is_not_supported_in_java\" >Why multiple inheritance is not supported in java?<\/a><\/li><\/ul><\/nav><\/div>\n<p>Multiple Inheritance is a feature of an object-oriented concept, where a class can inherit properties of more than one parent class. The problem occurs when there exist methods with the same signature in both the superclasses 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.<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/bit.ly\/3ELmCiA\" target=\"_blank\" rel=\"noopener\"><strong>To know more about Java, Download Entri App!<\/strong><\/a><\/p>\n<p>The idea behind inheritance in Java is that you can create new\u00a0classes<\/p>\n<p>that are built upon existing classes. When you inherit from an existing class, you can reuse methods and fields of the parent class. Moreover, you can add new methods and fields in your current class also.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Terms_used_in_Inheritance\"><\/span><strong>Terms used in Inheritance<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ul>\n<li><strong>Class:<\/strong>\u00a0A class is a group of objects which have common properties. It is a template or blueprint from which objects are created.<\/li>\n<li><strong>Sub Class\/Child Class:<\/strong>\u00a0Subclass is a class which inherits the other class. It is also called a derived class, extended class, or child class.<\/li>\n<li><strong>Super Class\/Parent Class:<\/strong>\u00a0Superclass is the class from where a subclass inherits the features. It is also called a base class or a parent class.<\/li>\n<li><strong>Reusability:<\/strong>\u00a0As the name specifies, reusability is a mechanism which facilitates you to reuse the fields and methods of the existing class when you create a new class. You can use the same fields and methods already defined in the previous class.<\/li>\n<\/ul>\n<p style=\"text-align: center;\"><strong><a href=\"https:\/\/bit.ly\/3ELmCiA\">Learn Coding in your Language! Enroll Here!<\/a><\/strong><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Types_of_inheritance_in_java\"><\/span><strong>Types of inheritance in java<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>On the basis of class, there can be three types of inheritance in java: single, multilevel and hierarchical.<\/p>\n<p>In java programming, multiple and hybrid inheritance is supported through interface only. We will learn about interfaces later.<\/p>\n<p>When one class inherits multiple classes, it is known as multiple inheritance. For Example:<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Single_Inheritance\"><\/span><strong>Single Inheritance\u00a0<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>When a class inherits another class, it is known as a\u00a0single inheritance. In the example given below, Dog class inherits the Animal class, so there is the single inheritance.<\/p>\n<p><strong>File: TestInheritance.java<\/strong><\/p>\n<ol>\n<li><strong>class<\/strong>Animal{<\/li>\n<\/ol>\n<ol>\n<li><strong>void<\/strong>\u00a0eat(){System.out.println(&#8220;eating&#8230;&#8221;);}<\/li>\n<\/ol>\n<ol start=\"3\">\n<li>}<\/li>\n<\/ol>\n<ol>\n<li><strong>class<\/strong>\u00a0Dog\u00a0<strong>extends<\/strong>\u00a0Animal{<\/li>\n<\/ol>\n<ol start=\"5\">\n<li><strong>void<\/strong>bark(){System.out.println(&#8220;barking&#8230;&#8221;);}<\/li>\n<\/ol>\n<ol>\n<li>}<\/li>\n<\/ol>\n<ol start=\"7\">\n<li><strong>class<\/strong>TestInheritance{<\/li>\n<\/ol>\n<ol>\n<li><strong>public<\/strong>\u00a0<strong>static<\/strong>\u00a0<strong>void<\/strong>\u00a0main(String\u00a0args[]){<\/li>\n<\/ol>\n<ol start=\"9\">\n<li>Dog\u00a0d=<strong>new<\/strong>Dog();<\/li>\n<\/ol>\n<ol>\n<li>d.bark();<\/li>\n<\/ol>\n<ol start=\"11\">\n<li>eat();<\/li>\n<\/ol>\n<ol>\n<li>}}<\/li>\n<\/ol>\n<p><strong>Output:<\/strong><\/p>\n<p>barking&#8230;eating&#8230;<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Multilevel_Inheritance\"><\/span><strong>Multilevel Inheritance\u00a0<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>When there is a chain of inheritance, it is known as\u00a0multilevel inheritance. As you can see in the example given below, BabyDog class inherits the Dog class which again inherits the Animal class, so there is a multilevel inheritance.<\/p>\n<p><strong>File: TestInheritance2.java<\/strong><\/p>\n<ol>\n<li><strong>class<\/strong>Animal{<\/li>\n<\/ol>\n<ol>\n<li><strong>void<\/strong>\u00a0eat(){System.out.println(&#8220;eating&#8230;&#8221;);}<\/li>\n<\/ol>\n<ol start=\"3\">\n<li>}<\/li>\n<\/ol>\n<ol>\n<li><strong>class<\/strong>\u00a0Dog\u00a0<strong>extends<\/strong>\u00a0Animal{<\/li>\n<\/ol>\n<ol start=\"5\">\n<li><strong>void<\/strong>bark(){System.out.println(&#8220;barking&#8230;&#8221;);}<\/li>\n<\/ol>\n<ol>\n<li>}<\/li>\n<\/ol>\n<ol start=\"7\">\n<li><strong>class<\/strong>BabyDog\u00a0<strong>extends<\/strong>\u00a0Dog{<\/li>\n<\/ol>\n<ol>\n<li><strong>void<\/strong>\u00a0weep(){System.out.println(&#8220;weeping&#8230;&#8221;);}<\/li>\n<\/ol>\n<ol start=\"9\">\n<li>}<\/li>\n<\/ol>\n<ol>\n<li><strong>class<\/strong>\u00a0TestInheritance2{<\/li>\n<\/ol>\n<ol start=\"11\">\n<li><strong>public<\/strong><strong>static<\/strong>\u00a0<strong>void<\/strong>\u00a0main(String\u00a0args[]){<\/li>\n<\/ol>\n<ol>\n<li>BabyDog\u00a0d=<strong>new<\/strong>\u00a0BabyDog();<\/li>\n<\/ol>\n<ol start=\"13\">\n<li>weep();<\/li>\n<\/ol>\n<ol>\n<li>d.bark();<\/li>\n<\/ol>\n<ol start=\"15\">\n<li>eat();<\/li>\n<\/ol>\n<ol>\n<li>}}<\/li>\n<\/ol>\n<p><strong>Output:<\/strong><\/p>\n<p>weeping&#8230;barking&#8230;eating&#8230;<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Hierarchical_Inheritance\"><\/span><strong>Hierarchical Inheritance\u00a0<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>When two or more classes inherits a single class, it is known as\u00a0hierarchical inheritance. In the example given below, Dog and Cat classes inherits the Animal class, so there is hierarchical inheritance.<\/p>\n<p><strong>File: TestInheritance3.java<\/strong><\/p>\n<ol>\n<li><strong>class<\/strong>Animal{<\/li>\n<\/ol>\n<ol>\n<li><strong>void<\/strong>\u00a0eat(){System.out.println(&#8220;eating&#8230;&#8221;);}<\/li>\n<\/ol>\n<ol start=\"3\">\n<li>}<\/li>\n<\/ol>\n<ol>\n<li><strong>class<\/strong>\u00a0Dog\u00a0<strong>extends<\/strong>\u00a0Animal{<\/li>\n<\/ol>\n<ol start=\"5\">\n<li><strong>void<\/strong>bark(){System.out.println(&#8220;barking&#8230;&#8221;);}<\/li>\n<\/ol>\n<ol>\n<li>}<\/li>\n<\/ol>\n<ol start=\"7\">\n<li><strong>class<\/strong>Cat\u00a0<strong>extends<\/strong>\u00a0Animal{<\/li>\n<\/ol>\n<ol>\n<li><strong>void<\/strong>\u00a0meow(){System.out.println(&#8220;meowing&#8230;&#8221;);}<\/li>\n<\/ol>\n<ol start=\"9\">\n<li>}<\/li>\n<\/ol>\n<ol>\n<li><strong>class<\/strong>\u00a0TestInheritance3{<\/li>\n<\/ol>\n<ol start=\"11\">\n<li><strong>public<\/strong><strong>static<\/strong>\u00a0<strong>void<\/strong>\u00a0main(String\u00a0args[]){<\/li>\n<\/ol>\n<ol>\n<li>Cat\u00a0c=<strong>new<\/strong>\u00a0Cat();<\/li>\n<\/ol>\n<ol start=\"13\">\n<li>meow();<\/li>\n<\/ol>\n<ol>\n<li>c.eat();<\/li>\n<\/ol>\n<ol start=\"15\">\n<li>\/\/c.bark();\/\/C.T.Error<\/li>\n<\/ol>\n<ol>\n<li>}}<\/li>\n<\/ol>\n<p><strong>Output:<\/strong><\/p>\n<p>meowing&#8230;eating&#8230;<\/p>\n<p style=\"text-align: center;\"><strong><a href=\"https:\/\/bit.ly\/3ELmCiA\">Learn Coding in your Language! Enroll Here!<\/a><\/strong><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Multiple_Inheritance\"><\/span><strong>Multiple Inheritance<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Java does not support multiple inheritance. Multiple inheritance means a class derived from more than one direct super class. This increases complexities and ambiguity in the relationship among classes. The problem is clearly visible if we consider what happens in function overriding. Suppose there are two classes, A and B, each defining a function called\u00a0<em>func()<\/em>. Now, let\u2019s say we define another class, C, which inherits both from A and B (multiple inheritance), but let\u2019s say this class does not override the function called\u00a0<em>func()<\/em>.<\/p>\n<p>Now, if we do something like the following:<\/p>\n<p>C c = new C();c.func();<\/p>\n<p>Can we determine which member function\u00a0<em>func()<\/em>\u00a0is invoked? Is it function defined by class A or class B? As we can see, the class C inherits this function doubly from both A and B. This creates ambiguity and the compiler is in a fix to resolve the issue. There is solution to this problem, but it\u2019s extremely complex; therefore, Java decided to stay away from the cause of the problem by not allowing multiple inheritance.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Multiple_Inheritance_with_Interfaces\"><\/span><strong>Multiple Inheritance with Interfaces<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Although Java does not allow multiple inheritance, it allows a multiple implementation of interfaces. So, in a way the idea is still there. Now, what is an interface?<\/p>\n<p>An interface describes a set of methods but does not provide any concrete implementation for all methods. We can implement the interface with the help of a class which provides the concrete implementation of the method. In this way, a class can implement more than one interface and therefore can provide a concrete implementation of methods derived from one or more interfaces. The class that implements one or more interfaces forms a\u00a0<em>is-a<\/em>\u00a0relationship with the interface type. This also means that objects instantiated from the class are guaranteed to provide the functionality declared by the interface. Any subclass derived from this class also provides the same functionality.<\/p>\n<p>Interfaces are especially useful for providing a common functionality to a number of possibly unrelated classes. Therefore, the object of classes that implement same interface can respond to method calls described in all of the interfaces.<\/p>\n<p>From Java 8, interfaces support default methods with its full implementation. As we know, a class can implement more than one interface; therefore, if multiple interfaces contain a default method with the same method signature, the implemented class should specify which particular method to use or override.<\/p>\n<p>Example<\/p>\n<p><strong>package<\/strong> com.mano.examples;<\/p>\n<p><strong>public interface<\/strong> Interface1 {<\/p>\n<p><strong>default void<\/strong> func(){<\/p>\n<p>System.<em><strong>out<\/strong><\/em>.println(<strong>&#8220;from interface 1&#8221;<\/strong>);<\/p>\n<p>}}<\/p>\n<p><strong>package<\/strong> com.mano.examples;<strong>public interface<\/strong> Interface2 {<\/p>\n<p><strong>default void<\/strong> func(){<\/p>\n<p>System.<em><strong>out<\/strong><\/em>.println(<strong>&#8220;from interface 2&#8221;<\/strong>);<\/p>\n<p>}}<\/p>\n<p><strong>package<\/strong> com.mano.examples;<strong>public class<\/strong> MyClass <strong>implements<\/strong> Interface1, Interface2 {<\/p>\n<p><strong>public void<\/strong> func(){\u00a0\u00a0\u00a0\u00a0\u00a0 <em>\/\/ Invoking Interface1 func() method<\/em><\/p>\n<p>Interface1.<strong>super<\/strong>.func();\u00a0\u00a0\u00a0\u00a0\u00a0 <em>\/\/ Invoking Interface2 func() method<\/em>\u00a0\u00a0\u00a0\u00a0\u00a0 Interface2.<strong>super<\/strong>.func();<\/p>\n<p>}<\/p>\n<p><strong>public static void<\/strong> main(String[] args){<\/p>\n<p>MyClass c=<strong>new<\/strong> MyClass();\u00a0\u00a0\u00a0\u00a0\u00a0 c.func();<\/p>\n<p>}<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Why_multiple_inheritance_is_not_supported_in_java\"><\/span><strong>Why multiple inheritance is not supported in java?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>To reduce the complexity and simplify the language, multiple inheritance is not supported in java.<\/p>\n<p>Consider a scenario where A, B, and C are three classes. The C class inherits A and B classes. If A and B classes have the same method and you call it from child class object, there will be ambiguity to call the method of A or B class.<\/p>\n<p>Since compile-time errors are better than runtime errors, Java renders compile-time error if you inherit 2 classes. So whether you have same method or different, there will be compile time error.<\/p>\n<ol>\n<li><strong>class<\/strong>A{<\/li>\n<\/ol>\n<ol>\n<li><strong>void<\/strong>\u00a0msg(){System.out.println(&#8220;Hello&#8221;);}<\/li>\n<\/ol>\n<ol start=\"3\">\n<li>}<\/li>\n<\/ol>\n<ol>\n<li><strong>class<\/strong>\u00a0B{<\/li>\n<\/ol>\n<ol start=\"5\">\n<li><strong>void<\/strong>msg(){System.out.println(&#8220;Welcome&#8221;);}<\/li>\n<\/ol>\n<ol>\n<li>}<\/li>\n<\/ol>\n<ol start=\"7\">\n<li><strong>class<\/strong>C\u00a0<strong>extends<\/strong>\u00a0A,B{\/\/suppose\u00a0if\u00a0it\u00a0were<\/li>\n<\/ol>\n<ol>\n<li><\/li>\n<\/ol>\n<ol start=\"9\">\n<li><strong>public<\/strong>\u00a0<strong>static<\/strong>\u00a0<strong>void<\/strong>\u00a0main(String\u00a0args[]){<\/li>\n<\/ol>\n<ol>\n<li>\u00a0\u00a0\u00a0C\u00a0obj=<strong>new<\/strong>\u00a0C();<\/li>\n<\/ol>\n<ol start=\"11\">\n<li>msg();\/\/Now\u00a0which\u00a0msg()\u00a0method\u00a0would\u00a0be\u00a0invoked?<\/li>\n<\/ol>\n<ol>\n<li>}<\/li>\n<\/ol>\n<ol start=\"13\">\n<li>}<\/li>\n<\/ol>\n<p><strong>Output:<\/strong><\/p>\n<p>Compile Time Error<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/entri.sng.link\/Bcofz\/uu8c\/w409\" target=\"_blank\" rel=\"noopener\"><strong><a href=\"https:\/\/bit.ly\/3ELmCiA\">Learn Coding in your Language! Enroll Here!<\/a><\/strong><\/a><\/p>\n<p>One of the classic problems with multiple inheritance is called the diamond problem. This can be tackled with the inheritance mechanism called virtual inheritance. But, experience says Java has not lost much by disallowing multiple inheritance altogether. In fact, the Java compiler has gotten rid of them by providing a complex solution to a problem that we can easily do away with. Still, there are OOP languages, such as C++, which support it.<\/p>\n<p><strong>Why is it important to choose Entri?<\/strong><\/p>\n<ul>\n<li>Excellent online platform for all the Competitive Exams.<\/li>\n<li>Provides updated materials created by the Entri Experts.<\/li>\n<li>Entri provides a best platform with full- length mock tests including previous year question papers.<\/li>\n<li>You can download the app for free and join the required classes.<\/li>\n<li>Entri wishes you all the best for your examinations and future endeavours.<\/li>\n<\/ul>\n<p><strong>\u201cYOU DON\u2019T HAVE TO BE GREAT TO START, BUT YOU HAVE TO START TO BE GREAT.\u201d<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Multiple Inheritance is a feature of an object-oriented concept, where a class can inherit properties of more than one parent class. The problem occurs when there exist methods with the same signature in both the superclasses and subclass. On calling the method, the compiler cannot determine which class method to be called and even on [&hellip;]<\/p>\n","protected":false},"author":55,"featured_media":25528074,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[802,558,1882],"tags":[],"class_list":["post-25528072","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-articles","category-general-knowledge","category-java-programming"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>The Problems Of Multiple Inheritance In Java - Entri Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"The Problems Of Multiple Inheritance In Java - Entri Blog\" \/>\n<meta property=\"og:description\" content=\"Multiple Inheritance is a feature of an object-oriented concept, where a class can inherit properties of more than one parent class. The problem occurs when there exist methods with the same signature in both the superclasses and subclass. On calling the method, the compiler cannot determine which class method to be called and even on [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/\" \/>\n<meta property=\"og:site_name\" content=\"Entri Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/entri.me\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-06-11T20:19:30+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-11-19T12:30:45+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/06\/The-Problems-Of-Multiple-Inheritance-In-Java.png\" \/>\n\t<meta property=\"og:image:width\" content=\"820\" \/>\n\t<meta property=\"og:image:height\" content=\"615\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Ayesha Surayya\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@entri_app\" \/>\n<meta name=\"twitter:site\" content=\"@entri_app\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ayesha Surayya\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/\"},\"author\":{\"name\":\"Ayesha Surayya\",\"@id\":\"https:\/\/entri.app\/blog\/#\/schema\/person\/568cc9d6e77fd5d01033b61c88343097\"},\"headline\":\"The Problems Of Multiple Inheritance In Java\",\"datePublished\":\"2022-06-11T20:19:30+00:00\",\"dateModified\":\"2022-11-19T12:30:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/\"},\"wordCount\":1338,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/entri.app\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/06\/The-Problems-Of-Multiple-Inheritance-In-Java.png\",\"articleSection\":[\"Articles\",\"General Knowledge\",\"Java Programming\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/\",\"url\":\"https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/\",\"name\":\"The Problems Of Multiple Inheritance In Java - Entri Blog\",\"isPartOf\":{\"@id\":\"https:\/\/entri.app\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/06\/The-Problems-Of-Multiple-Inheritance-In-Java.png\",\"datePublished\":\"2022-06-11T20:19:30+00:00\",\"dateModified\":\"2022-11-19T12:30:45+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/#primaryimage\",\"url\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/06\/The-Problems-Of-Multiple-Inheritance-In-Java.png\",\"contentUrl\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/06\/The-Problems-Of-Multiple-Inheritance-In-Java.png\",\"width\":820,\"height\":615,\"caption\":\"The Problems Of Multiple Inheritance In Java\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/entri.app\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Entri Skilling\",\"item\":\"https:\/\/entri.app\/blog\/category\/entri-skilling\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Java Programming\",\"item\":\"https:\/\/entri.app\/blog\/category\/entri-skilling\/java-programming\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"The Problems Of Multiple Inheritance In Java\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/entri.app\/blog\/#website\",\"url\":\"https:\/\/entri.app\/blog\/\",\"name\":\"Entri Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/entri.app\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/entri.app\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/entri.app\/blog\/#organization\",\"name\":\"Entri App\",\"url\":\"https:\/\/entri.app\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/entri.app\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2019\/10\/Entri-Logo-1.png\",\"contentUrl\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2019\/10\/Entri-Logo-1.png\",\"width\":989,\"height\":446,\"caption\":\"Entri App\"},\"image\":{\"@id\":\"https:\/\/entri.app\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/entri.me\/\",\"https:\/\/x.com\/entri_app\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/entri.app\/blog\/#\/schema\/person\/568cc9d6e77fd5d01033b61c88343097\",\"name\":\"Ayesha Surayya\",\"url\":\"https:\/\/entri.app\/blog\/author\/ayesha-surayya\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"The Problems Of Multiple Inheritance In Java - Entri Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/","og_locale":"en_US","og_type":"article","og_title":"The Problems Of Multiple Inheritance In Java - Entri Blog","og_description":"Multiple Inheritance is a feature of an object-oriented concept, where a class can inherit properties of more than one parent class. The problem occurs when there exist methods with the same signature in both the superclasses and subclass. On calling the method, the compiler cannot determine which class method to be called and even on [&hellip;]","og_url":"https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/","og_site_name":"Entri Blog","article_publisher":"https:\/\/www.facebook.com\/entri.me\/","article_published_time":"2022-06-11T20:19:30+00:00","article_modified_time":"2022-11-19T12:30:45+00:00","og_image":[{"width":820,"height":615,"url":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/06\/The-Problems-Of-Multiple-Inheritance-In-Java.png","type":"image\/png"}],"author":"Ayesha Surayya","twitter_card":"summary_large_image","twitter_creator":"@entri_app","twitter_site":"@entri_app","twitter_misc":{"Written by":"Ayesha Surayya","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/#article","isPartOf":{"@id":"https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/"},"author":{"name":"Ayesha Surayya","@id":"https:\/\/entri.app\/blog\/#\/schema\/person\/568cc9d6e77fd5d01033b61c88343097"},"headline":"The Problems Of Multiple Inheritance In Java","datePublished":"2022-06-11T20:19:30+00:00","dateModified":"2022-11-19T12:30:45+00:00","mainEntityOfPage":{"@id":"https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/"},"wordCount":1338,"commentCount":0,"publisher":{"@id":"https:\/\/entri.app\/blog\/#organization"},"image":{"@id":"https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/#primaryimage"},"thumbnailUrl":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/06\/The-Problems-Of-Multiple-Inheritance-In-Java.png","articleSection":["Articles","General Knowledge","Java Programming"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/","url":"https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/","name":"The Problems Of Multiple Inheritance In Java - Entri Blog","isPartOf":{"@id":"https:\/\/entri.app\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/#primaryimage"},"image":{"@id":"https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/#primaryimage"},"thumbnailUrl":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/06\/The-Problems-Of-Multiple-Inheritance-In-Java.png","datePublished":"2022-06-11T20:19:30+00:00","dateModified":"2022-11-19T12:30:45+00:00","breadcrumb":{"@id":"https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/#primaryimage","url":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/06\/The-Problems-Of-Multiple-Inheritance-In-Java.png","contentUrl":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/06\/The-Problems-Of-Multiple-Inheritance-In-Java.png","width":820,"height":615,"caption":"The Problems Of Multiple Inheritance In Java"},{"@type":"BreadcrumbList","@id":"https:\/\/entri.app\/blog\/the-problems-of-multiple-inheritance-in-java\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/entri.app\/blog\/"},{"@type":"ListItem","position":2,"name":"Entri Skilling","item":"https:\/\/entri.app\/blog\/category\/entri-skilling\/"},{"@type":"ListItem","position":3,"name":"Java Programming","item":"https:\/\/entri.app\/blog\/category\/entri-skilling\/java-programming\/"},{"@type":"ListItem","position":4,"name":"The Problems Of Multiple Inheritance In Java"}]},{"@type":"WebSite","@id":"https:\/\/entri.app\/blog\/#website","url":"https:\/\/entri.app\/blog\/","name":"Entri Blog","description":"","publisher":{"@id":"https:\/\/entri.app\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/entri.app\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/entri.app\/blog\/#organization","name":"Entri App","url":"https:\/\/entri.app\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/entri.app\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2019\/10\/Entri-Logo-1.png","contentUrl":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2019\/10\/Entri-Logo-1.png","width":989,"height":446,"caption":"Entri App"},"image":{"@id":"https:\/\/entri.app\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/entri.me\/","https:\/\/x.com\/entri_app"]},{"@type":"Person","@id":"https:\/\/entri.app\/blog\/#\/schema\/person\/568cc9d6e77fd5d01033b61c88343097","name":"Ayesha Surayya","url":"https:\/\/entri.app\/blog\/author\/ayesha-surayya\/"}]}},"_links":{"self":[{"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/posts\/25528072","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/users\/55"}],"replies":[{"embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/comments?post=25528072"}],"version-history":[{"count":4,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/posts\/25528072\/revisions"}],"predecessor-version":[{"id":25547453,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/posts\/25528072\/revisions\/25547453"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/media\/25528074"}],"wp:attachment":[{"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/media?parent=25528072"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/categories?post=25528072"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/tags?post=25528072"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}