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
How do you declare a destructor in java?
How do you check if a string is lexicographically in java?
How will you call an Applet using Java Script Function?
How do you format in java?
What are the advantages of passing this into a method instead of the current class object itself?
What is the function of compareto in java?
How does thread synchronization occurs inside a monitor? What levels of synchronization can you apply?
5 Coding best practices you learned in java?
What are the principle concepts of oops?
What are the benefits of java?
What’s meant by anonymous class?
What type of value does sizeof return?
How do you bind variables?
What are new features introduced with java 8 ?
Explain the available thread states in a high-level?