'2019/01/09'에 해당되는 글 1건

  1. 2019.01.09 Object.clone() 2
Programming/Java2019. 1. 9. 21:00

크.. 망할 자바 ㅠㅠ


아무생각 없이 Point 객체를 = 으로 넣어서 복사될 줄 알았는데

(아니 이렇게 관대한 녀석 아니었어?)

계속 값이 초기화 되서 지인에게 물어봤더니 clone()을 쓰라고..


일단은.. call by reference인지 call by value 인지 조금 더 공부해봐야겠다.. -_ㅠ


protected Object clone()

                throws CloneNotSupportedException

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression: 

[링크 : https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#clone()]

'Programming > Java' 카테고리의 다른 글

jaxb - Java Architecture for XML Binding  (0) 2019.06.25
jar 실행하기  (0) 2019.01.15
javax print  (0) 2019.01.03
jar 만들기 export  (0) 2019.01.03
Java SE 8 설치해보려고 했더니..  (2) 2019.01.03
Posted by 구차니