1、java官方教程里有一段话,解释了原因:
One reason why the Java programming language does not permit you to extend more than one class is to avoid the issues of multiple inheritance of state, which is the ability to inherit fields from multiple classes. For example, suppose that you are able to define a new class that extends multiple classes. When you create an object by instantiating that class, that object will inherit fields from all of the class's superclasses. What if methods or constructors from different superclasses instantiate the same field? Which method or constructor will take precedence? Because interfaces do not contain fields, you do not have to worry about problems that result from multiple inheritance of state.
http://docs.oracle.com/javase/tutorial/java/IandI/multipleinheritance.html
2、问题是这段话我没看懂啊,我操。
真的认认真真看了,而且这个教程一节一节看下来,没看懂的地方实在不多啊——可是这么关键性的这一段,居然看不懂啊我操。
3、大伙都抡起袖子来解释一番呗~
慕尼黑8549860
长风秋雁
繁星淼淼
相关分类