phoneitem.java

来自「Java ME手机应用开发大全一书的配套光盘上的源码」· Java 代码 · 共 67 行

JAVA
67
字号
/*
 * Created on 2005-2-3
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package net.garrey.model;

/**
 * @author Administrator
 * Written by Garrey. All rights reserved by Garrey.
 */
public class PhoneItem {
	private int id;
    private String phonenum=null;
    private String name=null;
    
    public PhoneItem(String name,String phonenum){
        this.name=name;
        this.phonenum=phonenum;
    }
    
    public PhoneItem(int id,byte[] data){
        this.id=id;
    	String temp=new String(data);
        int ind=temp.indexOf(",");
        if(ind!=-1){
            name=temp.substring(0,ind);
            phonenum=temp.substring(ind+1);
        }
    }
    
    public int getId(){
    	return id;
    }
    
    public void setId(int id){
    	this.id=id;
    }
    
    public String getPhonenum(){
        return phonenum;
    }
    
    public void setPhonenum(String num){
        phonenum=num;
    }
    
    public String getName(){
        return name;
    }
    
    public void setName(String na){
        name=na;
    }
    
    public byte[] getBytes(){
        String temp=null;
        if(name==null||phonenum==null){
            return null;
        }else{
            temp=name+","+phonenum;
        }
        return temp.getBytes();
    }
}

⌨️ 快捷键说明

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