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

Design a game in java, The game of Kala is played on a rectangular board: ...

The game of Kala is played on a rectangular board: In front of each player are six pits numbered 1 to 6 (called the 'side pits'). To the right of a player's side pits is a

Want inventory selection function in opentaps erp, Required: Inventory Sele...

Required: Inventory Selection Function in Opentaps ERP We work on Opentaps ERP and Application development framework. Our requirement is to modify the Inventory selection functi

Develop a java - jnlp application, Need Java/JNLP Application - GUI and Bac...

Need Java/JNLP Application - GUI and Backend Projects Project Description: I am looking for assistance in making changes to a complex java application. System launches fro

Describe overriding methods, Describe Overriding Methods ? Assume that...

Describe Overriding Methods ? Assume that one day you've just finished your Car class. It's been plugged into your traffic simulation that is chugging along merrily simulating

Loops, Use a while loop to count down from 100 and display all the numbers ...

Use a while loop to count down from 100 and display all the numbers in the * following pattern (you have to figure out what the pattern is - don''t go below 0): * 100 99 97 94

Data structures and algorithm, Create a class to implement the ArrayList co...

Create a class to implement the ArrayList collection. The name should be YourFirstNameArrayList; for example if I were creating the class then I would call it WaynesArrayList. Do

Develop contact list application, Develop Contact list application Proje...

Develop Contact list application Project Description: Prepare a computer application to help employees manage their contact list. Users must be able to store two kinds of con

Write a java rest client, Write a Java REST client to perform the following...

Write a Java REST client to perform the following- The client will read the contents of the file - invoice.txt. The first line of the file will display the type of the currency.

Implement queues - linked list, Implement Queues / Linked List Project D...

Implement Queues / Linked List Project Description: In this project, two kinds of queue are implemented: LinkedQueue implements FIFOQueueInterface { .... } and LLQueueItr imp

What is a framework, A framework is made up of the set of classes which per...

A framework is made up of the set of classes which permit us to use a library in a best possible way for a particular requirement.

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