???Java?е?clone??????????
???????????? ???????[ 2015/6/8 13:20:56 ] ????????????????
????Java?ж???????
????clone????????????? ??Java?????У? clone??????????????????????????ν????????????????????????????????С?????????????д???????μ?????????java?????У??м???????????????????
????1 ???new?????????????????
????2 ???clone???????????????
????????????????????????????? new???????????????????????????е?new????????? ???????new?????????????????????????????????????????????????????????????????ù???????????????????????????????????????????????????????????????????????????????????????????????????????????????ò????????????clone?????????new?????? ?????????棬????clone???????????????????????????clone????????????????????????????ж???????????????????? ?????????clone?????????????μ???????????????????????????????????÷?????????
??????????? or ????????
??????Java?У?????????????????????
????Person p = new Person(23?? "zhang");
????Person p1 = p;
????System.out.println(p);
????System.out.println(p1);
??????Person p1 = p;?????? ???????????μ?????? ?????????????
????com.pansoft.zhangjg.testclone.Person@2f9ee1ac
????com.pansoft.zhangjg.testclone.Person@2f9ee1ac
?????????????????????????????????????????????????????????????p??p1????????????????????????????????Person(23?? “zhang”) ?? ????????????????????????? ?????????ú??????????????ο???????????Java?е?String??????????? — String?????? ?? ?????????????????ú???????????????????????????? ????е?????????????
?????????????????????????????????????
????Person p = new Person(23?? "zhang");
????Person p1 = (Person) p.clone();
????System.out.println(p);
????System.out.println(p1);
?????????????????????????????????????????????????μ???? ?????????????????????????μ??????????
????com.pansoft.zhangjg.testclone.Person@2f9ee1ac
????com.pansoft.zhangjg.testclone.Person@67f1fba0
?????????????????? ????е?????????????
???????? or ?????
?????????????????У?Person??????????????????????name??age?? name??String????? age??int????????????????????????
????????age?????????????? ????????????????????飬???????4??????????????????С?????name??String?????? ????????????? ????????????String?????????????????????????? ??????????е?name???????????????????name??Σ? ??????????Person?????е?name???????????????????μ??????????????????????????????????????????????Person?????name??Ρ??????????????????????????????????????????????????????????
??????????????????????????????Person?????name?????????? ????????????name?????????String???? ?????????? ??????????????name?????????? ????????????String???? ????????Person???????? ????????name?????String???? ???????????????????£?
?????????????
????clone?????????
?????????clone??????е?????????? ???д????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11