首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件开发 >

《Head First设计形式》阅读笔记.第七章-外观模式实例补充

2012-10-31 
《Head First设计模式》阅读笔记.第七章-外观模式实例补充// 测试计算机外观类public class TestComputer {p

《Head First设计模式》阅读笔记.第七章-外观模式实例补充

// 测试计算机外观类public class TestComputer {public static void main(String[] args) {Power power = new Power();MainBoard board = new MainBoard();HardDisk disk = new HardDisk();OperationSystem system = new OperationSystem();Computer computer = new Computer(power, board, disk, system);computer.startup();computer.shutdown();}}


测试结果:
引用The power is connected.
The mainboard is on.
The harddisk is running.
The opertion system is startup.
The operation system is shutdown.
The harddisk is stopped.
The mainboard is off.
The power is disconnected.

热点排行