这个代码,我要输入什么才可以获取到信息,求大神
class worker
{
private String name;
private int age;
private float salary;
private int ID;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public float getSalary() {
return salary;
}
public void setSalary(float salary) {
this.salary = salary;
}
public int getID() {
return ID;
}
public void setID(int id) {
ID = id;
}
public worker(String name,int age,int ID,float salary){
//输入什么????
}
}
------解决方案--------------------如果我没理解错 你是要建立一个构造方法 可以这样写
this.name = name;
this.age = age;
this.ID = ID;
this.salary = salary;
我也新人 互相学习 如有不妥 请见谅