Because its object oriented structure you can't extend more than one class, instead you implement interfaces.
Think on this: you have a class named "Falcon" and other one named "Duck", you create a new class that extends from Falcon, then you can't inherit characteristics from a Duck , instead you create a super class named "Bird" so, "Falcon" and "Duck" can inherit some their own characteristics from "Bird". But if you need some characteristics like "owner"; an "owner" is not part of "Bird" class, but you need an owner indeed, so, you implement it like an "Owner" interface and "Owner" interface can be applied to other classes for example: Car, Hous,....
Sorry my spell but I hope my explanation was good enough.
Good luck
2006-09-18 23:12:00 UTC
The designers of java closely followed the features of C++ and left out what they considered confusing. They could see the pitfalls of pointer arithmetic and the almost impossible debugging required when multiple inheritance is used.
Single inheritance offers a cleaner design once you get used to it. The Interface accomplishes pretty much whatever you formerly got with multiple inheritance.
boland
2016-10-01 07:24:08 UTC
while they conflict to describe inheritance and interface they constantly provide diverse theory. i did no longer get why hierarchy is sensible in the beginning up. you're able to be responsive to that products exist in RAM, no longer as a form record. products could have: values, states, behaviors. as quickly as we build a hierarchy what the earnings is an identical-call approach() throughout categories of goods. for that reason, we could have a great type called RentalProperties house extends RentalProperties Studio extends RentalProperties House2BR extends RentalProperties Hostel extends RentalProperties quite a number of the RentalProperties can then have each and each type then could have its own habit approximately calculateRent(). it may additionally be extra complicated. assume scholars can purely hire residences, Hostel beds, Studios. A instructor can hire each and every thing yet a Hostel mattress. An interface is the extra effective layout for maintenance. If all of us started extending Hostel extends house, RentalProperties we've a multitude ... while the shopper needs transformations on that application, I end the job 2 weeks in the past, I won't do the transformations. by way of fact making the transformations on a various-inheritance will impact the entire hierarchy -- up and down -- the coder would be confronted with an entire re-make of this methodology. single-inheritance purely provides extra reuseable code.
Digitally Й!Й
2006-09-19 07:34:24 UTC
multiple inheritance cause ambiguity problem .. specially in case of dimond shape inheritance ... it a bug in C++ with is removed in Java by restricting it ..
ⓘ
This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.