what is d difference between deep cloning and shallow
cloning in core java?
Answer Posted / laxmikanth
In Shallow Cloning, you can only create the replica of the
objects but not the objects it is holding. Assume your Car
class (car1) has car name and Engine obj reference (has a
relation). Then by Shallow clone you can create anothr Car
Object (car2)but the newly created object will have its own
car name but the Engine Obj reference of car2 will still
point to car1's Engine.
In Deep Cloning, you can create the complete replica of car1
object.
| Is This Answer Correct ? | 4 Yes | 1 No |
Post New Answer View All Answers
What do you mean by access modifier?
What happens when you add a double value to a string?
Which is faster call by value or call by reference?
Where we write javascript code in html page?
What is a static class in java?
How can we access some class in another class in java?
Is array size fixed in java?
How to find the index of the largest number in an arraylist java?
What is difference between final and finally in java?
When do we use synchronized blocks and advantages of using synchronized blocks?
Explain java coding standards for variables ?
Can a serialized object be transferred via network?
When does a class need a virtual destructor?
What is the driver class?
What is a boolean flag in java?