user.java

来自「java chat java chat简易聊天室程序源代码,有很高的参考价值,能」· Java 代码 · 共 75 行

JAVA
75
字号
/* * 用户 */package chat.common;import java.io.Serializable;/** * * @author Administrator */public class User implements Serializable{    protected String userName;    protected String password;    public static User createAllUser(){        return new User("所有人","");    }    public User(String userName, String password) {        this.userName = userName;        this.password = password;    }    public String getPassword() {        return password;    }    public void setPassword(String password) {        this.password = password;    }    public String getUserName() {        return userName;    }    public void setUserName(String userName) {        this.userName = userName;    }        public String toString(){        return userName;    }    @Override    public boolean equals(Object obj) {        if (obj == null) {            return false;        }        if (getClass() != obj.getClass()) {            return false;        }        final User other = (User) obj;        if (this.userName != other.userName && (this.userName == null || !this.userName.equals(other.userName))) {            return false;        }        if (this.password != other.password && (this.password == null || !this.password.equals(other.password))) {            return false;        }        return true;    }    @Override    public int hashCode() {        int hash = 7;        hash = 89 * hash + (this.userName != null ? this.userName.hashCode() : 0);        hash = 89 * hash + (this.password != null ? this.password.hashCode() : 0);        return hash;    }                }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?