⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 user.java

📁 JAVA Servlet2.3外文书籍源码
💻 JAVA
字号:
package forum;

import java.util.*;

/**
 * Represents a user in the discussion forum.
 *
 * @author    Simon Brown
 */
public class User {

  /** the user id */
  private String id;

  /** the password */
  private String password;

  /**
   * Creates a new user with the specified id and password.
   *
   * @param id        the user id
   * @param password  the password
   */
  User(String id, String password) {
    this.id = id;
    this.password = password;
  }

  /**
   * Getter for the user id property.
   *
   * @return  the user id
   */
  public String getId() {
    return this.id;
  }

  /**
   * Getter for the password property.
   *
   * @return  the password
   */
  String getPassword() {
    return this.password;
  }

  /**
   * Determines whether this object is the same as another.
   *
   * @param o   the Object to test against
   * @return  true if the specified object is equal to this one,
   *          false otherwise
   */
  public boolean equals(Object o) {
    if (o instanceof User) {
      User u = (User)o;

      return getId().equals(u.getId());
    } else {
      return false;
    }
  }

}

⌨️ 快捷键说明

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