package com.Summer_0427.cn;

/**
 * @author Summer
 * 通过类可以实现多个接口的功能
 * 应用实例:计算机及其设备连接两项电和三项电的应用
 */
interface ThreeElectronic{
    void threeService();
}

interface TwoElectronic{
    void twoService();
}

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

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

public class TestElectronic {

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

}

 

相关文章:

  • 2022-02-08
  • 2021-11-14
  • 2022-12-23
  • 2021-12-19
  • 2022-12-23
  • 2022-12-23
  • 2021-08-30
猜你喜欢
  • 2022-01-17
  • 2021-10-01
  • 2021-10-25
  • 2022-12-23
  • 2022-02-08
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案