Provides a single inheritance between classes and classes in Java.
There may be errors in providing multiple inheritance, such as: A class inherits two parent classes, and two parent classes have the show () method.
Class fulei1{
public void Show () {
System.out.println ("Parent Class 1");
}
}
Class fulei2{
public void Show () {
System.out.println ("Parent Class 2");
}
}
Class Zilei extends fulei1,fulei2{
public static void Main (string[] args) {
Zilei p=new Zilei ();
The call is faulted because the call is indeterminate and the Java code does not know which parent class to invoke.
P.show ();
}
}
However, there can be multiple inheritance between the interface and the interface.
Why interfaces and interfaces can inherit more, the reason, the interface method is not implemented specifically, the implementation requires subclasses to rewrite the interface of the method, all does not exist as the above-called uncertainty.
Why Java classes are single-inheritance. The inheritance of the class, implements the interface.