class Cpu{
void Init(){
System.out.println("Cpu组件已启动");
}
}
class Memory{
void Init(){
System.out.println("内存组件已启动");
}
}
class Iossystem{
void Init(){
System.out.println("输入输出组件已启动");
}
}
class Computer {
Cpu cpu;
Memory memory;
Iossystem iossystem;
public Computer(Cpu cpu, Memory memory, Iossystem iossystem) {
this.cpu = cpu;
this.memory = memory;
this.iossystem = iossystem;
}
public void start() {
cpu.Init();
memory.Init();
iossystem.Init();
}
}
public class test{
public static void main(String[] args) {
Cpu i=new Cpu();
Memory m=new Memory();
Iossystem ios=new Iossystem();
Computer c=new Computer(i,m,ios);
c.start();
}
}
08-21
755
02-17
1272