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.

55 lines
1.6 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package com.javaBean;
/**
* Account类简化版仅包含用户的登录信息。
*/
public class Account {
String userid; // 用户ID
String password; // 登录密码
/**
* 默认构造函数,创建一个空白账户对象。
*/
public Account() {
// 默认构造函数无需特别处理,保持空白即可
}
/**
* 构造函数用于初始化Account对象的userid和password属性。
*
* @param userid 用户ID
* @param password 登录密码
*/
public Account(String userid, String password) {
this.userid = userid;
this.password = password;
}
// Getter and Setter 方法仅保留userid和password的访问器
public String getuserid() {
return userid;
}
public void setuserid(String userid) {
this.userid = userid;
}
public String getpassword() {
return password;
}
public void setpassword(String password) {
this.password = password;
}
/**
* 重写toString方法提供友好的字符串表示形式通常用于日志输出或简单显示。
*
* @return 字符串格式用户ID:密码(实际应用中,直接打印密码可能不安全,此处仅为示例)
*/
@Override
public String toString() {
// 注意在真实环境中直接在toString方法中暴露密码是不安全的这里为了演示才这样写
return this.userid + ":" + "********"; // 用星号代替密码的实际显示,以增强安全性提示
}
}