#Java interfaces can be inherited, and it is multiple inheritance, but only interfaces can inherit interfaces, and classes can only implement interfaces. An interface can inherit another interface or multiple interfaces, and a common class can implement multiple interfaces.
Specific code: (Recommended learning: java course)
interface A{ void a1(); } interface B{ void b1(); } interface C extends A,B{//注意该语法只对接口的继承是合法的 void c1(); } class D implements C{ @Override public void a1() {} @Override public void b1() {} @Override public void c1() {} }
The above is the detailed content of Can java interfaces be inherited?. For more information, please follow other related articles on the PHP Chinese website!