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

What is pop, The Post Office Protocol is an application-level protocol with...

The Post Office Protocol is an application-level protocol within an intranet which is used by the local e-mail clients to send and retrieve e-mails from a remote server those are l

Mobile pop-under script for mobile browsers, Project Description: Give a...

Project Description: Give a script that will produce a pop-under on a mobile landing page -We can host our own landing page and we will want to change the destination URL for

What are the difference between throw and throws, What are the difference b...

What are the difference between throw and throws? Differences are between throws and throw are: Throw is employed to trigger an exception while throws is used in declara

What is bandwidth, What is bandwidth? In a general way Bandwidth is a c...

What is bandwidth? In a general way Bandwidth is a capacity of communication channel of carrying data.

Is java is network oriented or not, Distributed / Network Oriented Java...

Distributed / Network Oriented Java is network friendly -- both in its portable, threaded nature, and since common networking operations are built-in to the Java libraries.

Design patterns, what is the use of design pattern in java ?

what is the use of design pattern in java ?

Data Structures Projects, I have three data structures projects that I need...

I have three data structures projects that I need help with.

School management, i need java program for account to hold payment of stude...

i need java program for account to hold payment of student

What is linear search, What is linear search? It is the simplest form o...

What is linear search? It is the simplest form of search. It searches for the element sequentially starting from first element. This search has a drawback if element is located

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