标签:11 14 void System public println display out
在计算机主机(Mainframe)中,只需要按下主机的开机按钮(on()),即可调用其他硬件设备和软件的启动方法 ,如内存(Memory)的自检(check())、CPU的运行(run())、硬盘(HardDisk)的读取(read())、操作系统(OS)的载入(load()),如果某一过程发生错误则计算机启动失败
package com.zheng;
public class MainFrame {
private Memory memory=new Memory(); //关联关系建立联系
private Cpu cpu=new Cpu();
private HardDisk harddisk=new HardDisk();
private Os os=new Os();
public void fun() {
memory.display();
cpu.display();
harddisk.display();
os.display();
System.out.println("开机正常");
}
}
package com.zheng;
public class Memory {
public void display() {
System.out.println("1、内存正常");
}
}
package com.zheng;
public class Cpu {
public void display() {
System.out.println("2、cpu运行正常");
}
}
package com.zheng;
public class HardDisk {
public void display() {
System.out.println("3、硬盘读取正常");
}
}
package com.zheng;
public class Os {
public void display() {
System.out.println("4、操作系统载入正常");
}
}
package com.zheng;
import java.util.Scanner;
public class Client {
public static void main(String[] args) {
// TODO 自动生成的方法存根
while (true) {
MainFrame f = new MainFrame();
Scanner scan = new Scanner(System.in);
System.out.println("请输入ON进行开机:");
String str = scan.nextLine();
if (str.equals("ON")) {
f.fun();
} else {
System.out.println("输入的信息有误!!!请重新输入");
}
}
}
}
标签:11,
14,
void,
System,
public,
println,
display,
out
From: https://www.cnblogs.com/YFLZ/p/17832174.html