我不是在问这个-> Why is there no multiple inheritance in Java, but implementing multiple interfaces is allowed?
在Java中,不允许多重继承,但是在Java 8之后,接口可以有默认方法(可以自己实现方法),就像抽象类一样。在这种情况下,还应该允许多重继承。
interface TestInterface
{
// abstract method
public void square(int a);
// default method
default void show()
{
System.out.println("Default Method Executed");
}
}
https://stackoverflow.com/questions/52620936
复制相似问题