0
why java does not support multiple inheritance???
inheritance
5 Antworten
+ 1
Lets say you have animal class and your boss come to you and require that you make new classes for animals with long fur,short fur and feathers.also you need anomalas which walk,crawl and swimm.if you use inheritance you have to make 9 new class to cover all possibilities.
+ 1
what if you boss come next and say,we need animals with tail and not.also we need animals which fly and jumo too.how many new class have to make you now?what you can do?you can anly cry and text your friends that you do not come on party that night.but what if...you creat interface for every feature and implement that interface for evry new kind of that feature?and in animal class define variabke for every feature interface.then you can create any kind of animals with animal class and with couple if new classes.also you can change animal class feature on fly (in runtime).so...inheritance is not perfect tool at all.why would we need multiple inheretance?for the record,there is multiple interface implementation in java.have a nice day;-)
+ 1
i did not succeed to put answer in one post so it become two part answer.
0
Multiple Inheritance has a problem which is most commonly known as 'Deadly Diamond of Death'.
Though C++ support Multiple Inheritance, Java doesn't.
To the rescue, In java you can use Interface.
0
multiple inheritance in java is possible with interfaces