public class MainFrame{ // 实例变量 - 用你自己的变量替换下面的例子 private String name; private String brand; private Power pow; /*private HDD hdd; private Memory mem; private Mainboard mbo; private CPU cpu;*/ /** * 类 zhuji 的对象的构造函数 */ public void MainFrame(String name,String brand,Power pow,HDD hdd,Memory mem,Mainboard mbo,CPU cpu) { // 初始化实例变量 this.name=name; this.brand=brand; this.pow=pow; /*this.hdd=hdd; this.mem=mem; this.mbo=mbo; this.cpu=cpu;*/ } public void setPow(Power pow) { this.pow=pow; } public void printMainFrame() { System.out.println("主机名:"+name); System.out.println("出厂商:"+brand); //this.mem.printMemoryInfo(); //this.mbo.printMainboardInfo(); this.pow.printPowerInfo(); //this.cpu.printCPUInfo(); //this.hdd.printHDDInfo(); }}
添加回答
举报
0/150
提交
取消