Class extending more than one class Java?

后端 未结 11 1566
执笔经年
执笔经年 2020-12-06 04:29

I know that a class can implement more than one interface, but is it possible to extend more than one class? For example I want my class to extend both TransformGroup<

11条回答
  •  南笙
    南笙 (楼主)
    2020-12-06 05:08

    Multiple inheritance is not possible with class, you can achieve it with the help of interface but not with class. It is by design of java language. Look a comment by James gosling.

    by James Gosling in February 1995 gives an idea on why multiple inheritance is not supported in Java.

    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.

提交回复
热议问题