写一个people类
ID,name,job,work,salary,address
行为:
sound(),run(),work(),show time();
创建两个对象,分别就不同的人。填写进去

people类Java
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
1条回答 默认 最新
- piaoyiren 2022-07-16 11:54关注
import java.util.Date; public class People { private Integer id; private String name; private String job; private String work; private Double salary; private String address; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getJob() { return job; } public void setJob(String job) { this.job = job; } public String getWork() { return work; } public void setWork(String work) { this.work = work; } public Double getSalary() { return salary; } public void setSalary(Double salary) { this.salary = salary; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public void sound() { System.out.println(this.name +" is singing"); } public void run() { System.out.println(this.name+" is running"); } public void work() { System.out.println(this.name+" is working"); } public void showTime() { System.out.println(new Date()); } public People(Integer id, String name, String job, String work, Double salary, String address) { super(); this.id = id; this.name = name; this.job = job; this.work = work; this.salary = salary; this.address = address; } public static void main(String[] args) { People p1=new People(1, "zs", "java", "biancheng", 3455.6, "南山"); People p2=new People(2, "lisi", "java", "设计", 3455.6, "南山"); } }
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 1无用