가능한 중복 :
How do I copy an object in Java?자바에서 객체를 어떻게 깊게 복사합니까?
는 자바 같이 할 됐나요? 둘 다 객체가 여전히 같은지도를 참조하시기 깊은 사본 —의
public class CacheTree {
private Multimap<Integer, Integer> a;
private Integer b;
public void copy(CacheTree anotherObj) {
this.a = anotherObj.getA();
this.b = anotherObj.getB();
}
public Multimap<Integer, Integer> getA() {
return a;
}
public Integer getB() {
return b;
}
}
public void main() {
CacheTree x = new CacheTree();
CacheTree y = new CacheTree();
x.copy(y); // Is it ok ?
}
http://stackoverflow.com/questions/64036/ 페이지 2 코드와 아주 좋은 예를 제공합니다 How-do-make-a-deep-copy-of-object-in-java – Hubbitus