You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.1 KiB

public class Users {
private final String name;
private final String password;
private final String type;
private static final Users[] USERS = {
new Users("张三1", "123", "小学"),
new Users("张三2", "123", "小学"),
new Users("张三3", "123", "小学"),
new Users("李四1", "123", "初中"),
new Users("李四2", "123", "初中"),
new Users("李四3", "123", "初中"),
new Users("王五1", "123", "高中"),
new Users("王五2", "123", "高中"),
new Users("王五3", "123", "高中")
};
public Users(String name, String password, String type) {
this.name = name;
this.password = password;
this.type = type;
}
public String getType() {
return type;
}
public String getName() {
return name;
}
public String getPassword() {
return password;
}
public static Users login(String name, String password) {
for (Users users : USERS) {
if (users.getName().equals(name) && users.getPassword().equals(password)) {
return users;
}
}
return null;
}
}