package com.Summer_0427.cn;

/**
 * @author Summer
 * 接口之间多继承的应用
 * 应用实例:计算机及其设备、插排与两项电和三项电的应用
 */
interface ThreeElectronic{
    void threeService();
}

interface TwoElectronic{
    void twoService();
}
//接口的继承和多继承,实现了接口的功能合并和
interface Socket extends ThreeElectronic,TwoElectronic{
    void socketService();
}

class Computer implements Socket{
    @Override
    public void threeService() {
        System.out.println("计算机本身用三项电通电");    
    }

    @Override
    public void twoService() {
        System.out.println("计算机上的外置设备用两项电通电");
        
    }

    @Override
    public void socketService() {
        System.out.println("计算机上连接的插排进行供电");
        
    }
    
}

public class TestElectronic {

    public static void main(String[] args) {
        Computer cp = new Computer();
        cp.threeService();
        cp.twoService();
        cp.socketService();
    }

}

 

相关文章:

  • 2021-12-31
  • 2022-12-23
  • 2021-08-09
  • 2022-12-23
  • 2021-12-05
  • 2022-02-09
猜你喜欢
  • 2021-10-01
  • 2022-02-08
  • 2021-07-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-01
相关资源
相似解决方案