parent
f7c2c3005b
commit
d4f8cd980b
@ -0,0 +1,44 @@
|
|||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue