Any changes on the cloned object will it reflect the original object in java? [closed]












1














Any changes on the cloned object will it reflect the original object?.Please anyone explain how clone() method works internally.










share|improve this question













closed as too broad by karthik, Oleg Estekhin, EdChum, Alexander Vogt, Matteo Mosca Jan 20 '15 at 10:17


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.











  • 1




    stackoverflow.com/questions/869033/…
    – Tirath
    Jan 20 '15 at 5:16
















1














Any changes on the cloned object will it reflect the original object?.Please anyone explain how clone() method works internally.










share|improve this question













closed as too broad by karthik, Oleg Estekhin, EdChum, Alexander Vogt, Matteo Mosca Jan 20 '15 at 10:17


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.











  • 1




    stackoverflow.com/questions/869033/…
    – Tirath
    Jan 20 '15 at 5:16














1












1








1


1





Any changes on the cloned object will it reflect the original object?.Please anyone explain how clone() method works internally.










share|improve this question













Any changes on the cloned object will it reflect the original object?.Please anyone explain how clone() method works internally.







java






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 20 '15 at 5:09









Balasubramani

2172515




2172515




closed as too broad by karthik, Oleg Estekhin, EdChum, Alexander Vogt, Matteo Mosca Jan 20 '15 at 10:17


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.






closed as too broad by karthik, Oleg Estekhin, EdChum, Alexander Vogt, Matteo Mosca Jan 20 '15 at 10:17


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.










  • 1




    stackoverflow.com/questions/869033/…
    – Tirath
    Jan 20 '15 at 5:16














  • 1




    stackoverflow.com/questions/869033/…
    – Tirath
    Jan 20 '15 at 5:16








1




1




stackoverflow.com/questions/869033/…
– Tirath
Jan 20 '15 at 5:16




stackoverflow.com/questions/869033/…
– Tirath
Jan 20 '15 at 5:16












1 Answer
1






active

oldest

votes


















4














So cloning is about creating the copy of original object. Its dictionary meaning is : “make an identical copy of“.



By default, java cloning is ‘field by field copy’ i.e. as the Object class does not have idea about the structure of class on which clone() method will be invoked. So, JVM when called for cloning, do following things:



1) If the class has only primitive data type members then a completely new copy of the object will be created and the reference to the new object copy will be returned.



2) If the class contains members of any class type then only the object references to those members are copied and hence the member references in both the original object as well as the cloned object refer to the same object.



If you want a clone which is independent of original and making changes in clone should not affect original. then you can use the Deep cloning



Here's the complete guide: http://howtodoinjava.com/2012/11/08/a-guide-to-object-cloning-in-java/






share|improve this answer

















  • 1




    Thank you Dyrandz.
    – Balasubramani
    Jan 20 '15 at 5:21


















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









4














So cloning is about creating the copy of original object. Its dictionary meaning is : “make an identical copy of“.



By default, java cloning is ‘field by field copy’ i.e. as the Object class does not have idea about the structure of class on which clone() method will be invoked. So, JVM when called for cloning, do following things:



1) If the class has only primitive data type members then a completely new copy of the object will be created and the reference to the new object copy will be returned.



2) If the class contains members of any class type then only the object references to those members are copied and hence the member references in both the original object as well as the cloned object refer to the same object.



If you want a clone which is independent of original and making changes in clone should not affect original. then you can use the Deep cloning



Here's the complete guide: http://howtodoinjava.com/2012/11/08/a-guide-to-object-cloning-in-java/






share|improve this answer

















  • 1




    Thank you Dyrandz.
    – Balasubramani
    Jan 20 '15 at 5:21
















4














So cloning is about creating the copy of original object. Its dictionary meaning is : “make an identical copy of“.



By default, java cloning is ‘field by field copy’ i.e. as the Object class does not have idea about the structure of class on which clone() method will be invoked. So, JVM when called for cloning, do following things:



1) If the class has only primitive data type members then a completely new copy of the object will be created and the reference to the new object copy will be returned.



2) If the class contains members of any class type then only the object references to those members are copied and hence the member references in both the original object as well as the cloned object refer to the same object.



If you want a clone which is independent of original and making changes in clone should not affect original. then you can use the Deep cloning



Here's the complete guide: http://howtodoinjava.com/2012/11/08/a-guide-to-object-cloning-in-java/






share|improve this answer

















  • 1




    Thank you Dyrandz.
    – Balasubramani
    Jan 20 '15 at 5:21














4












4








4






So cloning is about creating the copy of original object. Its dictionary meaning is : “make an identical copy of“.



By default, java cloning is ‘field by field copy’ i.e. as the Object class does not have idea about the structure of class on which clone() method will be invoked. So, JVM when called for cloning, do following things:



1) If the class has only primitive data type members then a completely new copy of the object will be created and the reference to the new object copy will be returned.



2) If the class contains members of any class type then only the object references to those members are copied and hence the member references in both the original object as well as the cloned object refer to the same object.



If you want a clone which is independent of original and making changes in clone should not affect original. then you can use the Deep cloning



Here's the complete guide: http://howtodoinjava.com/2012/11/08/a-guide-to-object-cloning-in-java/






share|improve this answer












So cloning is about creating the copy of original object. Its dictionary meaning is : “make an identical copy of“.



By default, java cloning is ‘field by field copy’ i.e. as the Object class does not have idea about the structure of class on which clone() method will be invoked. So, JVM when called for cloning, do following things:



1) If the class has only primitive data type members then a completely new copy of the object will be created and the reference to the new object copy will be returned.



2) If the class contains members of any class type then only the object references to those members are copied and hence the member references in both the original object as well as the cloned object refer to the same object.



If you want a clone which is independent of original and making changes in clone should not affect original. then you can use the Deep cloning



Here's the complete guide: http://howtodoinjava.com/2012/11/08/a-guide-to-object-cloning-in-java/







share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 20 '15 at 5:17









Dyrandz Famador

3,76251533




3,76251533








  • 1




    Thank you Dyrandz.
    – Balasubramani
    Jan 20 '15 at 5:21














  • 1




    Thank you Dyrandz.
    – Balasubramani
    Jan 20 '15 at 5:21








1




1




Thank you Dyrandz.
– Balasubramani
Jan 20 '15 at 5:21




Thank you Dyrandz.
– Balasubramani
Jan 20 '15 at 5:21



Popular posts from this blog

鏡平學校

ꓛꓣだゔៀៅຸ໢ທຮ໕໒ ,ໂ'໥໓າ໼ឨឲ៵៭ៈゎゔit''䖳𥁄卿' ☨₤₨こゎもょの;ꜹꟚꞖꞵꟅꞛေၦေɯ,ɨɡ𛃵𛁹ޝ޳ޠ޾,ޤޒޯ޾𫝒𫠁သ𛅤チョ'サノބޘދ𛁐ᶿᶇᶀᶋᶠ㨑㽹⻮ꧬ꧹؍۩وَؠ㇕㇃㇪ ㇦㇋㇋ṜẰᵡᴠ 軌ᵕ搜۳ٰޗޮ޷ސޯ𫖾𫅀ल, ꙭ꙰ꚅꙁꚊꞻꝔ꟠Ꝭㄤﺟޱސꧨꧼ꧴ꧯꧽ꧲ꧯ'⽹⽭⾁⿞⼳⽋២៩ញណើꩯꩤ꩸ꩮᶻᶺᶧᶂ𫳲𫪭𬸄𫵰𬖩𬫣𬊉ၲ𛅬㕦䬺𫝌𫝼,,𫟖𫞽ហៅ஫㆔ాఆఅꙒꚞꙍ,Ꙟ꙱エ ,ポテ,フࢰࢯ𫟠𫞶 𫝤𫟠ﺕﹱﻜﻣ𪵕𪭸𪻆𪾩𫔷ġ,ŧآꞪ꟥,ꞔꝻ♚☹⛵𛀌ꬷꭞȄƁƪƬșƦǙǗdžƝǯǧⱦⱰꓕꓢႋ神 ဴ၀க௭எ௫ឫោ ' េㇷㇴㇼ神ㇸㇲㇽㇴㇼㇻㇸ'ㇸㇿㇸㇹㇰㆣꓚꓤ₡₧ ㄨㄟ㄂ㄖㄎ໗ツڒذ₶।ऩछएोञयूटक़कयँृी,冬'𛅢𛅥ㇱㇵㇶ𥄥𦒽𠣧𠊓𧢖𥞘𩔋цѰㄠſtʯʭɿʆʗʍʩɷɛ,əʏダヵㄐㄘR{gỚṖḺờṠṫảḙḭᴮᵏᴘᵀᵷᵕᴜᴏᵾq﮲ﲿﴽﭙ軌ﰬﶚﶧ﫲Ҝжюїкӈㇴffצּ﬘﭅﬈軌'ffistfflſtffतभफɳɰʊɲʎ𛁱𛁖𛁮𛀉 𛂯𛀞నఋŀŲ 𫟲𫠖𫞺ຆຆ ໹້໕໗ๆทԊꧢꧠ꧰ꓱ⿝⼑ŎḬẃẖỐẅ ,ờỰỈỗﮊDžȩꭏꭎꬻ꭮ꬿꭖꭥꭅ㇭神 ⾈ꓵꓑ⺄㄄ㄪㄙㄅㄇstA۵䞽ॶ𫞑𫝄㇉㇇゜軌𩜛𩳠Jﻺ‚Üမ႕ႌႊၐၸဓၞၞၡ៸wyvtᶎᶪᶹစဎ꣡꣰꣢꣤ٗ؋لㇳㇾㇻㇱ㆐㆔,,㆟Ⱶヤマފ޼ޝަݿݞݠݷݐ',ݘ,ݪݙݵ𬝉𬜁𫝨𫞘くせぉて¼óû×ó£…𛅑הㄙくԗԀ5606神45,神796'𪤻𫞧ꓐ㄁ㄘɥɺꓵꓲ3''7034׉ⱦⱠˆ“𫝋ȍ,ꩲ軌꩷ꩶꩧꩫఞ۔فڱێظペサ神ナᴦᵑ47 9238їﻂ䐊䔉㠸﬎ffiﬣ,לּᴷᴦᵛᵽ,ᴨᵤ ᵸᵥᴗᵈꚏꚉꚟ⻆rtǟƴ𬎎

Why https connections are so slow when debugging (stepping over) in Java?