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

Why does java have two ways to create child threads?

472


Can you explain the meaning of aggregation and composition

574


Why wait(),notify(),notifyAll() methods defined in Object class althought we are using in only threads.

2380


Can private method static?

475


how to deploy tomcatserver to weblogic server? write d following steps?

1455






Can you add null to a list java?

589


What is meant by string is immutable?

527


Why synchronization is important?

591


Can we create our own daemon thread?

544


Differentiate between postfix and prefix operators in java.

652


Which number is denoted by leading zero in java?

817


What is the default value of an object reference declared as an instance variable?

544


What is string and its types?

619


What is an object class?

568


Where are global variables stored?

513