public class Computer {
private String CPU;
private int memory;
private int disk;
// public Computer() {
// }
public Computer(String CPU, int memory, int disk) {
this.CPU = CPU;
this.memory = memory;
this.disk = disk;
}
public String getCPU() {
return CPU;
}
public void setCPU(String CPU) {
this.CPU = CPU;
}
public int getMemory() {
return memory
编写 Computer 类,包含 CPU、内存、硬盘等属性,getDetails 方法用于返回 Computer 的详细信息 编写 PC 子类,继承 Computer 类,添加特有属性 brand
最新推荐文章于 2022-11-29 11:14:18 发布