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

What are 4 pillers of object orinted programming?

578


Can we use string in switch case in java?

565


Is string an object?

646


How to sort array of 0 and 1 in java?

539


Explain list interface?

515






Are registers volatile?

525


Can an interface extend another interface?

592


What are the elements of java?

557


What is natural ordering in java?

519


What is the purpose of static keyword in java?

510


What is an interface in java?

557


You're given a Boolean 2D matrix, can you find the number of islands?

591


Can we use catch statement for checked exceptions?

508


what is bmg file and how to create that files?what will it contailn?

1880


Is {a, n, d} a palindrome? If you are given a random string, is it a palindrome or not?

617