设计一个台灯类lamp其中台灯有灯泡这个属性java 怎么写
答案:2 悬赏:70 手机版
解决时间 2021-03-19 13:32
- 提问者网友:欲望失宠
- 2021-03-19 00:44
设计一个台灯类lamp其中台灯有灯泡这个属性java 怎么写
最佳答案
- 五星知识达人网友:野慌
- 2021-03-19 02:12
你可以参照这个来
public class Department {
private Integer departmentId;
private String departmentName;
public Integer getDepartmentId() {
return departmentId;
}
public void setDepartmentId(Integer departmentId) {
this.departmentId = departmentId;
}
public String getDepartmentName() {
return departmentName;
}
public void setDepartmentName(String departmentName) {
this.departmentName = departmentName;
}
}
import java.util.Date;
public class Employee {
private Integer employeeId;
private String employeeName;
private Date hireDate;
private Department department;
public Integer getEmployeeId() {
return employeeId;
}
public void setEmployeeId(Integer employeeId) {
this.employeeId = employeeId;
}
public String getEmployeeName() {
return employeeName;
}
public void setEmployeeName(String employeeName) {
this.employeeName = employeeName;
}
public Date getHireDate() {
return hireDate;
}
public void setHireDate(Date hireDate) {
this.hireDate = hireDate;
}
public Department getDepartment() {
return department;
}
public void setDepartment(Department department) {
this.department = department;
}
}
public class Department {
private Integer departmentId;
private String departmentName;
public Integer getDepartmentId() {
return departmentId;
}
public void setDepartmentId(Integer departmentId) {
this.departmentId = departmentId;
}
public String getDepartmentName() {
return departmentName;
}
public void setDepartmentName(String departmentName) {
this.departmentName = departmentName;
}
}
import java.util.Date;
public class Employee {
private Integer employeeId;
private String employeeName;
private Date hireDate;
private Department department;
public Integer getEmployeeId() {
return employeeId;
}
public void setEmployeeId(Integer employeeId) {
this.employeeId = employeeId;
}
public String getEmployeeName() {
return employeeName;
}
public void setEmployeeName(String employeeName) {
this.employeeName = employeeName;
}
public Date getHireDate() {
return hireDate;
}
public void setHireDate(Date hireDate) {
this.hireDate = hireDate;
}
public Department getDepartment() {
return department;
}
public void setDepartment(Department department) {
this.department = department;
}
}
全部回答
- 1楼网友:荒野風
- 2021-03-19 02:37
public class Lamp{
//灯泡
private String bulb;
public String getBulb() {
return bulb;
}
public void setBulb(String bulb) {
this.bulb= bulb;
}
}
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯