Diamond/Ambiguity problem of multiple inheritance due to Default methods in Java 8 [ SOLVED !! ]

preview_player
Показать описание
Diamond problem (in inheritance) is an ambiguity problem that can arise as a consequence of allowing multiple inheritance through default methods that were introduced in java 8.

Udemy Course of Code Decode on Microservice k8s AWS CICD link:

Course Description Video :

Multiple Inheritance is a feature of object oriented concept, where a class can inherit properties of more than one parent class. The problem occurs when there exist methods with same signature in both the super classes 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.

In order to avoid Diamond problem in inheritance or ambiguity Java does not support multiple inheritance of classes. It is keeping the things simple and straightforward.

You can achieve multiple inheritance in Java, using the default methods (Java8) and interfaces.

#diamondprobleminjava #ambiguityinjava #java8
Рекомендации по теме
Комментарии
Автор

getting clarity of concepts with your videos.. good work :)

shubhamtagalpallewar
Автор

hey @Code Decode can you plz tell if this is the only way to resolve diamond issue in java 8 or later versions

VijayKumar-bcfu
Автор

really u r great. Programming god and what ever u explains really easily & understandable.

subbhalakshmiravichandran
Автор

I got a doubt over riding is known only in the run time right how can you find the error at the compile time

armediaworks
Автор

We can give our own implementation in the livesin default method in the frog class also right??

prakashksk
Автор

Nice explanation. But can you explain how super helps in this case?

desaiaditya
Автор

At time 3:35 it is implementing multiple interfaces right ? But I could listen it as multiple inheritance. Please correct me if am wrong

mpsarun
Автор

Didi.. itna tough class name mt lo.. confuse ho jata hun..
Easy class name rakha kro

sachinsinghania