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

  Рет қаралды 37,116

Code Decode

Code Decode

Күн бұрын

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:
openinapp.co/u...
Course Description Video :
yt.openinapp.c...
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

Пікірлер: 22
@shubhamtagalpallewar7125
@shubhamtagalpallewar7125 4 жыл бұрын
getting clarity of concepts with your videos.. good work :)
@CodeDecode
@CodeDecode 4 жыл бұрын
thanks for the nice words :)
@sachinsinghania7806
@sachinsinghania7806 4 жыл бұрын
Didi.. itna tough class name mt lo.. confuse ho jata hun.. Easy class name rakha kro
@CodeDecode
@CodeDecode 4 жыл бұрын
Ok. No worries. Next time se easy class names rakhnge hum.
@start1learn-n171
@start1learn-n171 7 ай бұрын
Tq
@subbhalakshmiravichandran3808
@subbhalakshmiravichandran3808 2 жыл бұрын
really u r great. Programming god and what ever u explains really easily & understandable.
@CodeDecode
@CodeDecode 2 жыл бұрын
Thanks Subbhalakshmi 🙂👍
@VijayKumar-bc7fu
@VijayKumar-bc7fu 2 жыл бұрын
hey @Code Decode can you plz tell if this is the only way to resolve diamond issue in java 8 or later versions
@rohitverma8184
@rohitverma8184 Жыл бұрын
English bhoot achi hai madam
@CodeDecode
@CodeDecode Жыл бұрын
Thanks Rohit😊👍
@prakashksk861
@prakashksk861 4 жыл бұрын
We can give our own implementation in the livesin default method in the frog class also right??
@CodeDecode
@CodeDecode 4 жыл бұрын
Here basically I have shown you over ridden method in frog class. And default method is a concept of interface not a class. Frog is a class and aquatic and terrestrial animals are interfaces. Hence lives in default method is written in interfaces and not in frog class
@prakashksk861
@prakashksk861 4 жыл бұрын
Got it. Thank u 🙂
@CodeDecode
@CodeDecode 4 жыл бұрын
Any thing else I can help you with?
@prakashksk861
@prakashksk861 4 жыл бұрын
@@CodeDecode what are the new features in garbage collector from java 8.
@mpsarun7210
@mpsarun7210 2 жыл бұрын
At time 3:35 it is implementing multiple interfaces right ? But I could listen it as multiple inheritance. Please correct me if am wrong
@VijayKumar-bc7fu
@VijayKumar-bc7fu 2 жыл бұрын
thats how multiple inheritance is handled
@armediaworks4372
@armediaworks4372 3 жыл бұрын
I got a doubt over riding is known only in the run time right how can you find the error at the compile time
@KeshariPiyush24
@KeshariPiyush24 Жыл бұрын
Actually overriding is runtime polymorphism you are right about it but it does not mean that the compiler can't know about it in advance. Actually by overriding we mean which implementation to call it depends upon the kind of object you are calling and that's it.
@desaiaditya12
@desaiaditya12 3 жыл бұрын
Nice explanation. But can you explain how super helps in this case?
@chaitanyapatil9692
@chaitanyapatil9692 2 жыл бұрын
super keyword is used to invoke parent class's or interface's methods or variables !!!
How To Get Married:   #short
00:22
Jin and Hattie
Рет қаралды 23 МЛН
Остановили аттракцион из-за дочки!
00:42
Victoria Portfolio
Рет қаралды 3,8 МЛН
when you have plan B 😂
00:11
Andrey Grechka
Рет қаралды 67 МЛН
Поветкин заставил себя уважать!
01:00
МИНУС БАЛЛ
Рет қаралды 7 МЛН
The Flaws of Inheritance
10:01
CodeAesthetic
Рет қаралды 946 М.
Java's Creators Rejected Multiple Inheritance - Here's Why
13:14
Coding with John
Рет қаралды 69 М.
01. Internal Working of HashMap & Java-8 Enhancement
19:11
Ankit Wasankar
Рет қаралды 115 М.
How To Get Married:   #short
00:22
Jin and Hattie
Рет қаралды 23 МЛН