Can you inherit interface in Java

Can you inherit interface in Java

Answer: Yes interface can extend another interface. Example below:

package com.javahonk.interfacetest;

public interface AInterface {
public void m1();
}
package com.javahonk.interfacetest;

public interface BInterface extends AInterface {
public void m2();
}
package com.javahonk.interfacetest;

public interface CInterface extends AInterface, BInterface {
	public void m3();
}

 

Leave a Reply

Your email address will not be published. Required fields are marked *