package atmsystem;
    import java.io.Serializable;

    // 这个User类,目的只是为了记录User.txt(数据库)中的一行信息:帐号-密码-余额
    public class User implements Serializable {
    /*
    建议:
    除了{私有属性(无参数、有参数构造方法)、属性对应的get、set }之外
    类实现一个序列化接口,添加一个序列化版本号.
    因为万一未来有用的时候,不至于要改代码.
    直接一步到位
    File—>Settings—>Editor—>Inspections—>Java
    —>Serialization issues—>Serializable class without ‘serialVersionUID’
    */
    private static final long _serialVersionUID = 1406005760612010227L;

    1. private String aname;<br /> private String apassword;<br /> private Float abalance;
    2. // 构造方法<br /> public User(){}<br /> public User(String aname, String apassword, Float abalance) {<br /> this.aname = aname;<br /> this.apassword = apassword;<br /> this.abalance = abalance;<br /> }
    3. public String getAname() {<br /> return aname;<br /> }<br /> public void setAname(String aname) {<br /> this.aname = aname;<br /> }<br /> public String getApassword() {<br /> return apassword;<br /> }<br /> public void setApassword(String apassword) {<br /> this.apassword = apassword;<br /> }<br /> public Float getAbalance() {<br /> return abalance;<br /> }<br /> public void setAbalance(Float abalance) {<br /> this.abalance = abalance;<br /> }<br />}