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

📄 entry.java

📁 j2me简单实例,j2me教程加源码,希望大家喜欢
💻 JAVA
字号:
package com.j2medev.chapter3.phonebook;

public final class Entry {
    //自增1的标志量
    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;
    }
    //Setter 和 Getter方法
    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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -