标签:ati rdd image highlight static 速度 计算机 com etc
PC.java
public class PC { CPU cpu; HardDisk HD; public void setCPU(CPU c) { this.cpu = c; } public void setHardDisk(HardDisk h) { HD = h; } public void show() { System.out.println("cpu: " +cpu.getSeepd()); System.out.println("Hd: "+HD.getAmount()); } }
CPU.java
public class CPU { private int speed; public void setSeepd(int m) { this.speed = m; } public int getSeepd() { return speed; } }
HardDisk.java
public class HardDisk { int amount; public void setAmount(int m) { this.amount = m; } public int getAmount() { return amount; } }
Test.java
public class Test { public static void main(String[] args) { CPU cpu =new CPU(); cpu.setSeepd(2000); HardDisk disk = new HardDisk(); disk.setAmount(200); PC pc =new PC(); pc.setCPU(cpu); pc.setHardDisk(disk); pc.show(); } }
运行结果:
标签:ati rdd image highlight static 速度 计算机 com etc
原文地址:https://www.cnblogs.com/wuyibb/p/9792707.html