用JAVA语言写一个管理员类Manager.用show方法返回管理员信息,编写测试类Manager
1个回答
展开全部
//Manager类:
public class Manager {
private String id;
private String name;
private int age;
public Manager() {
}
public Manager(String id, String name, int age) {
this.id = id;
this.name = name;
this.age = age;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = 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 void show() {
System.out.println("Manager{" +
"id='" + id + '\'' +
", name='" + name + '\'' +
", age=" + age +
'}');
}
}
//Manager类:
public class MagagerTest {
public static void main(String[] args) {
Manager manager = new Manager("1001", "张飞", 30);
manager.show();
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询