tag:blogger.com,1999:blog-7955003209126272036.post5407067468921252869..comments2024-02-23T23:16:22.861+05:30Comments on Geek Explains: Java, J2EE, Oracle, Puzzles, and Problem Solving!: What is Cloning? How clone() method works in Java?Geekhttp://www.blogger.com/profile/00648920090539126396noreply@blogger.comBlogger12125tag:blogger.com,1999:blog-7955003209126272036.post-59988721276797675742020-04-12T18:41:11.030+05:302020-04-12T18:41:11.030+05:30Nice article . There is good coding example collec...Nice article . There is good coding example collection visit <a href="https://www.javavogue.com/2015/11/top-50-core-java-coding-programming.html/" rel="nofollow"> <br /> Top coding program example</a>subham kumarhttps://www.blogger.com/profile/01727881826778414825noreply@blogger.comtag:blogger.com,1999:blog-7955003209126272036.post-75809917129449559252020-04-12T18:32:44.592+05:302020-04-12T18:32:44.592+05:30Well explained object cloning in java . Thanks ver...Well explained object cloning in java . Thanks very much for sharing good article. There is also good resource for java<br /> clone visit <a href="https://www.javavogue.com/2015/11/object-cloning-in-java-example.html/" rel="nofollow"> Object Cloning in java </a> subham kumarhttps://www.blogger.com/profile/01727881826778414825noreply@blogger.comtag:blogger.com,1999:blog-7955003209126272036.post-38432645747245357182013-10-22T07:47:22.358+05:302013-10-22T07:47:22.358+05:30I had lots of doubt about object cloning and clone...I had lots of doubt about object cloning and <a href="http://javarevisited.blogspot.com/2013/09/how-clone-method-works-in-java.html" rel="nofollow">clone method</a>, and this post certainly helps me. It's tricky and not definitely not easy.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7955003209126272036.post-31286418235575316172013-01-28T08:53:20.769+05:302013-01-28T08:53:20.769+05:30Simple and clear explanation. Thank you.Simple and clear explanation. Thank you.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7955003209126272036.post-84239839771562101502013-01-28T08:52:33.258+05:302013-01-28T08:52:33.258+05:30Simple and easy to understand. Helps in understand...Simple and easy to understand. Helps in understanding the problem associated with clone. Thank you.Shwethahttps://www.blogger.com/profile/04992391028356041419noreply@blogger.comtag:blogger.com,1999:blog-7955003209126272036.post-54756451817593175292013-01-04T19:00:56.749+05:302013-01-04T19:00:56.749+05:30This comment has been removed by the author.Richard Byrdkhttps://www.blogger.com/profile/04962197828812259296noreply@blogger.comtag:blogger.com,1999:blog-7955003209126272036.post-78277908436386561462012-04-24T02:42:33.865+05:302012-04-24T02:42:33.865+05:30Thanks for such a nice explanation on object copyi...Thanks for such a nice explanation on object copyingYashuhttps://www.blogger.com/profile/17735242076766431527noreply@blogger.comtag:blogger.com,1999:blog-7955003209126272036.post-51257173438259943992012-01-21T23:24:54.118+05:302012-01-21T23:24:54.118+05:30"PQR" basically creates a 'new' ..."PQR" basically creates a 'new' String object and when you call jwz.setName("PQR") then the object reference of 'name' field in 'jwz' instance gets reset with the newly created reference for "PQR" (assuming usual 'Employee' class/method definition). Does this help?<br /><br />Please publish more details as to what you observe and what Geekhttps://www.blogger.com/profile/00648920090539126396noreply@blogger.comtag:blogger.com,1999:blog-7955003209126272036.post-14415748607296732232012-01-19T13:59:39.448+05:302012-01-19T13:59:39.448+05:30Nice explaination. I have one doubt though. What i...Nice explaination. I have one doubt though. What if i change the member object variable value as in below? it should reflect the new changed values in original object, right?<br /><br />public class CloneExample<br />{<br /> public static void main(String arg[])<br /> {<br /> Employee jwz = new Employee();<br /> jwz.setName("XYZ");<br /> jwz.setDesignation("CA");<br /> <brAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-7955003209126272036.post-38377702930866148042011-12-03T12:11:13.992+05:302011-12-03T12:11:13.992+05:30Not sure if I understood your question.
Result of...Not sure if I understood your question.<br /><br />Result of objA.equals(objACloned) obviously depends upon how have you overridden 'equals' for Class A. But, assuming your 'equals' implementation is checking the values of members, then objA.equals(objACloned) will initially return 'true' as shallow copy (default clone impl) will get new copies of primitives while the Geekhttps://www.blogger.com/profile/00648920090539126396noreply@blogger.comtag:blogger.com,1999:blog-7955003209126272036.post-79001869169272622622011-11-23T20:23:53.808+05:302011-11-23T20:23:53.808+05:30Clearly explained. Thanks.
But I am not clear how ...Clearly explained. Thanks.<br />But I am not clear how it returns <br />objA.equals(objACloned) --> true, initially even.<br /><br />When clone objeA and create ObjACloned, it creates separate memory location for cloned obj.<br /><br /><br />A objA = new A();<br />A objACloned = (A) objA.clone();Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7955003209126272036.post-24212007916120891852011-02-21T15:10:31.074+05:302011-02-21T15:10:31.074+05:30Nice updates!! I like your information so much...Nice updates!! I like your information so much...groupon clonehttp://grouponclone.contussupport.com/noreply@blogger.com