Difference b/w deep cloning and shallow cloning of object, JAVA Programming

Assignment Help:

The default nature of an object's clone() function automatically provides a shallow copy. So to need a deep copy the classes have to be edited or adjusted.

 

Shallow copy: If a shallow copy is operated on obj-1 as shown in fig then it is copied but its contained objects are not copied. The contained objects Obj-2 and Obj-1 are affected by modifies to cloned Obj-2. Java use shallow cloning of objects by default when a class implements the java.lang.Cloneable interface.

 

Deep copy: If a deep copy is operated on obj-1 as shown in fig then not only obj-1 has been copied but the objects properties also copied as well. Serialization may be used to achieve deep cloning. Deep cloning through serialization is faster to deploy and easier to maintain but carries a performance overhead.

 

 

1520_Untitled.png


Related Discussions:- Difference b/w deep cloning and shallow cloning of object

How trojan horses or worms affect a computer system, How Trojan Horses or W...

How Trojan Horses or Worms affect a computer system? What guidelines should be adopted to troubleshoot along with malicious software? Trojan horses are stand-alone programs. Th

Program, Luminous Jewels - The Polishing Game Byteland county is very famo...

Luminous Jewels - The Polishing Game Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various lum

Draw out a uml class diagram, Question: (a) Draw out a UML class diagra...

Question: (a) Draw out a UML class diagram that captures the following information: An Employee is a kind of Person. An ATM is a kind of Machine. Both an Employee and an ATM

Linked list, i want code for to print prime numbers in the linked list queu...

i want code for to print prime numbers in the linked list queue and stack and array in java programming

Insert admob code into android application, Need to Insert Admob Code Into ...

Need to Insert Admob Code Into Android Application Project Description: We are seeking Android developer to add Admob code in to our application. It should be very simple

Want an android app to be build, Want an Android App to be Build What i ...

Want an Android App to be Build What i want is a Taxi App for Android and if good price for iOS too. The App want to have a Website where to add Cars whit all information and

Functions, wap to find all the prime palindromic numbers

wap to find all the prime palindromic numbers

Program, Write a program called Power that displays the positive powers of ...

Write a program called Power that displays the positive powers of 2. When the user enters the exponent at a prompt, the program displays 2 to that power. The program halts when the

Maintenance and administration activities, Maintenance and Administration a...

Maintenance and Administration activities: Name                        : e-Commerce OS and Soft wares    : Websphere 6.0, IHS, Unix, Weblogic 8.1   Maintenance an

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd