接口可以继承多个接口- interface A {
- public void sayA();
- }
- interface B {
- public void sayB();
- }
- interface C extends A, B {
- }
- public class InterfaceDemo implements C {
- @Override
- public void sayA() {
- System.out.println("A say");
- }
- @Override
- public void sayB() {
- System.out.println("B say");
- }
- public static void main(String[] args) {
- // C is an interface
- C xx = new InterfaceDemo();
- xx.sayA();
- xx.sayB();
- }
- }
复制代码 |