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
Explain about the interpreter in java?
How many functional interfaces does java 8 have?
What are the various access specifiers in java?
How do you get the length of a string in java?
how would you implement a thread pool? : Java thread
What is the purpose of extern variable?
What are the types of methods in java?
What is the purpose of file class?
When a thread is executing synchronized methods , then is it possible to execute other synchronized methods simultaneously by other threads?
What is hashtable and explain features of hashtable?
Is char a method in java?
What is the difference between Java1.4 and Java1.5
What are methods of a class?
What is widening and narrowing in java? Discuss with an example.
Is java code slower than native code?