CoreJava/exp11/Account.java

38 lines
722 B
Java
Raw Permalink Normal View History

2024-05-15 20:49:31 +08:00
package exp11;
public class Account {
private String username;
private String password;
2024-05-15 23:50:53 +08:00
private boolean lock;
2024-05-15 20:49:31 +08:00
2024-05-15 23:50:53 +08:00
public Account(String username, String password, String lock) {
2024-05-15 20:49:31 +08:00
this.username = username;
this.password = password;
2024-05-15 23:50:53 +08:00
if(lock.equals("true")){
this.lock = true;
}else {
this.lock = false;
}
2024-05-15 20:49:31 +08:00
}
String getUserName() {
return this.username;
}
String getPassword() {
return this.password;
}
2024-05-15 23:50:53 +08:00
boolean isLock() {
return lock;
}
void lock() {
this.lock = true;
}
2024-05-15 20:49:31 +08:00
public String toString() {
2024-05-15 23:50:53 +08:00
return this.username +"," +this.password +"," +this.lock;
2024-05-15 20:49:31 +08:00
}
}