又试了一下楼主所说的接口多继承是正确的
代码:
- interface C{
- void mC();
- }
- interface A {
- void mA();
- }
- interface B extends A ,C{
- void mB();
- }
- class Tmp implements B {
- @Override
- public void mA() {
- // TODO Auto-generated method stub
- System.out.println("I am A");
- }
- @Override
- public void mB() {
- // TODO Auto-generated method stub
- System.out.println("I am B");
- }
- @Override
- public void mC() {
- // TODO Auto-generated method stub
- System.out.println("I am C");
- }
- }
- class Test {
- public static void main(String args[]) {
- Tmp t = new Tmp();
- t.mA();
- t.mB();
- t.mC();
- }
- }
复制代码
打印结果:
|