Any way to extend two or more classes in java?

前端 未结 12 1564
再見小時候
再見小時候 2021-01-17 02:20

I know that Java does not allow us to extend more than one class. I know that interfaces also exist and I don\'t want to use them this time. Is there some kind of trick or w

12条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-17 02:59

    NO.

    go for interfaces.No multiple inheritance in Java.

    Multiple inheritance can cause the diamond problem.

    JAVA omits many rarely used, poorly understood, confusing features of C++ that in our experience bring more grief than benefit. This primarily consists of operator overloading (although it does have method overloading), multiple inheritance, and extensive automatic coercions _ Dr. James Gosling

提交回复
热议问题