写一个 people类
id,name,age,job,salary ,address
行为:
sound(); run();sport();work();showTime();
创建两个对象,分别就不同的人。填写进去
写一个 people类
id,name,age,job,salary ,address
行为:
sound(); run();sport();work();showTime();
创建两个对象,分别就不同的人。填写进去
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, "南山");
}
}