2 Star 0 Fork 0

BESTI.IS.JAVA2018/20165337

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
PC.java 986 Bytes
一键复制 编辑 原始数据 按行查看 历史
import java.util.Objects;
public class PC {
PC(){
}
PC (CPU cpu) {
this.cpu = cpu;
}
PC (HardDisk HD) {
this.HD = HD;
}
PC (CPU cpu,HardDisk HD) {
this.cpu = cpu;
this.HD = HD;
}
public void setCpu(CPU c) {
this.cpu = c;
}
public void setHardDisk(HardDisk h) {
this.HD = h;
}
CPU cpu;
HardDisk HD;
void show() {
System.out.println("The speed of CPU:"+cpu.speed);
System.out.println("The amount of HD:"+HD.amount);
}
@Override
public String toString() {
return "PC{" +
"cpu=" + cpu +
", HD=" + HD +
'}';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PC pc = (PC) o;
return Objects.equals(cpu, pc.cpu) &&
Objects.equals(HD, pc.HD);
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/BESTI-IS-JAVA-2018/20165337.git
git@gitee.com:BESTI-IS-JAVA-2018/20165337.git
BESTI-IS-JAVA-2018
20165337
20165337
master

搜索帮助