标签:方法 屏蔽 pre 定义 color 引入 解决办法 委派 etl
public class CPU { public static final Logger LOGGER = Logger.getLogger(CPU.class); public void start() { LOGGER.info("cpu is start..."); } public void shutDown() { LOGGER.info("CPU is shutDown..."); } } public class Disk { public static final Logger LOGGER = Logger.getLogger(Disk.class); public void start() { LOGGER.info("Disk is start..."); } public void shutDown() { LOGGER.info("Disk is shutDown..."); } } public class Memory { public static final Logger LOGGER = Logger.getLogger(Memory.class); public void start() { LOGGER.info("Memory is start..."); } public void shutDown() { LOGGER.info("Memory is shutDown..."); } }
public class Computer { public static final Logger LOGGER = Logger.getLogger(Computer.class); private CPU cpu; private Memory memory; private Disk disk; public Computer() { cpu = new CPU(); memory = new Memory(); disk = new Disk(); } public void start() { LOGGER.info("Computer start begin"); cpu.start(); disk.start(); memory.start(); LOGGER.info("Computer start end"); } public void shutDown() { LOGGER.info("Computer shutDown begin"); cpu.shutDown(); disk.shutDown(); memory.shutDown(); LOGGER.info("Computer shutDown end..."); } }
public class Cilent { public static final Logger LOGGER = Logger.getLogger(Cilent.class); public static void main(String[] args) { Computer computer = new Computer(); computer.start(); LOGGER.info("================="); computer.shutDown(); } }
标签:方法 屏蔽 pre 定义 color 引入 解决办法 委派 etl
原文地址:https://www.cnblogs.com/stanwuc/p/10906941.html