例子:
public class Outbound2splitVO implements Serializable ,Cloneable {
private long id;
private String brand;
public long getId() {
return id;
}
public void setId(long id){
this.id=id;
}
public void setBrand(String brand) {
this.brand=brand;
}
public String getBrand(){
return brand;
}
public Object clone(){
Outbound2splitVO o = null;
try{
o = (Outbound2splitVO)super.clone();
}catch(CloneNotSupportedException e){
e.printStackTrace();
}
return o;
}
}
类必须实现Cloneable接口,clone方法。