Zhousan
package edu.xcdq;
public class Zhousan {
//属性
String name;
int quanxian; //权限
String depart; //部门
//方法
public void kaimen(){
System.out.println("管理员开门");
}
public void guanmen(){
System.out.println("管理员正在关门");
}
public void showMessage(){
System.out.println("管理员的名字" + name +"部门:" +depart+"权限"+quanxian);
}
}
Zhousan2
package edu.xcdq;
public class Zhousan2 {
public static void main(String[] args) {
// 创建管理员对象
Zhousan admin = new Zhousan();
Zhousan admin1 = new Zhousan();
admin.name = "管理员小王";
admin.quanxian = 6 ;
admin.depart = "保卫处";
admin1.name = "管理员小李";
admin1.quanxian = 7 ;
admin1.depart = "保卫处";
admin.kaimen();
admin.guanmen();
admin.showMessage();
}
}