我正在做一个涉及创建帐户的程序,我需要创建它以便它扫描特定数据以执行分配的命令。getter 和 setter 函数是否适合它?
public class Account {
//data
private int userId;
private String password;
private char type;
public Account(int userId, String password, char type) {
this.userId = userId;
this.password = password;
this.type = type;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public char getType() {
return type;
}
public void setType(char type) {
this.type = type;
}
//methods
public boolean verifyLogin(int usrid , String pass)
{
if((usrid == userId) & (pass == password)){
return true;
}
else{
return false;
}
}
青春有我
宝慕林4294392
相关分类