entry.java

来自「<j2me 开发精解> 詹建光著 里所有的源码。对J2me的开发相当」· Java 代码 · 共 75 行

JAVA
75
字号
package com.j2medev.chapter3.phonebook;

public final class Entry {

    private static int id_seq = 0;

    private int id;
    private String name;
    private String mobile;
    private String phone;
    private String email;

    private static int nextId() {
        id_seq++;
        return id_seq;
    }

    public Entry(String name, String mobile, String phone, String email) {
        this.id = nextId();
        this.name = name;
        this.mobile = mobile;
        this.phone = phone;
        this.email = email;
    }

    public int getId() {
        return id;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public boolean equals(Object obj) {
        if(this==obj)
            return true;
        if(obj instanceof Entry) {
            return ((Entry)obj).id==this.id;
        }
        return false;
    }

    public int hashCode() {
        return id;
    }
}

⌨️ 快捷键说明

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