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


Please Help Members By Posting Answers For Below Questions

Explain about the interpreter in java?

625


How many functional interfaces does java 8 have?

606


What are the various access specifiers in java?

569


How do you get the length of a string in java?

522


how would you implement a thread pool? : Java thread

510






What is the purpose of extern variable?

540


What are the types of methods in java?

580


What is the purpose of file class?

550


When a thread is executing synchronized methods , then is it possible to execute other synchronized methods simultaneously by other threads?

572


What is hashtable and explain features of hashtable?

566


Is char a method in java?

519


What is the difference between Java1.4 and Java1.5

1830


What are methods of a class?

544


What is widening and narrowing in java? Discuss with an example.

562


Is java code slower than native code?

563