how many types of cloning?

Answers were Sorted based on User's Feedback



how many types of cloning?..

Answer / krishnachaitanya

Cloning is done in two types:
1.Shallow Cloning
2.Deep Cloning

depends on how you override clone()in you class

Is This Answer Correct ?    20 Yes 4 No

how many types of cloning?..

Answer / seventh k

hey,this is core java section,isn't it?

Object's clone() is a method in JavaProgrammingLanguage,for
object duplication,to copy the functionality of a
class.Class Object's clone() creates and returns a copy of
the object,with the same class and with all the fields
having the same values.Object.clone() throws a
CloneNotSupported exception,unless u implement marker
Interface Cloneable.

two types of clonning:
1. Shallow Clonning: this is the default implementation
of Object.clone(), the clone will be a protected one.

2. Deep Cloning:classes must override clone(),to get the
Deep clonning.

Is This Answer Correct ?    4 Yes 2 No

how many types of cloning?..

Answer / vineesh ktda

1. Difference between shallow copy and deep copy
. 2. How to implement shallow copy ?
3. How to mplement deep copy? .
A shallow copy creates an identical copy (new instance) of an object .If an object contains reference (pointer) type fields pointing to other objects then it copies only the references and not the objects to which they point. The result is two objects that point to the same contained object. That means the original object and cloned object maintains a seperate copy for value (primtive) type fields , references and shares common place for value of reference type fields. So in shallow copy , the changes in the value of reference type fields of cloned object also reflects in the original objects and vice versa. Shallow copy can be implemented by using the clone method of an Object class
A deep copy creates an identical copy of an object including the references and the objects they point to , as well as any references or objects contained within that and so on. In deep copy , the changes in the value of reference type fields of cloned object does not reflect in the original objects and vice versa.. There is no direct method for deep copy . But there are many ways to implement the deep copy.
1. You can use constructor of an object to create a second object with property values taken from the first object.
2. You can use clone method of an Object class to create a shallow copy of an object , and make it deep copy by assigning new objects whose values are the same as the original object to reference type fields. The DeepCopy method in the example illustrates this approach.
3. Use Serialization technique ie. Serialize the object , and then deserialize to a different object variable which implements deep copy.

Is This Answer Correct ?    0 Yes 1 No

how many types of cloning?..

Answer / j.g.i.

two main types, however this does not include DNA Cloning..

Reproductive cloning is performed with the express intent
of creating another organism. This organism is the exact
duplicate of one that already exists or has existed in the
past. Cloning of plants, animals, and humans falls into the
class of reproductive cloning. The genetic material from a
donor egg is removed, so that you are left with an empty
egg. Then, a cell is taken from the organism to be cloned
and its nucleus is removed. This nucleus is then
transferred into the empty donor egg. Using chemicals or a
mild electric shock, the egg is forced to divide, creating
an embryo. This embryo is then transferred into the uterus
of the host organism.
Therapeutic cloning is performed, not to produce another
organism, but to harvest embryonic stem cells for use in
medical treatments. Therapeutic cloning is intended for
medical use. The embryonic stem cells that this type of
cloning produces can be used to create skin for burn
victims, organs for transplant patients, or cells for those
with spinal cord injuries. And because the cells come from
the patients themselves, there are no issues of cell
rejection. Therapeutic cloning may also help those
suffering from heart disease, Alzheimer's disease, or even
Parkinson's disease. The therapeutic cloning process is
very similar to that of reproductive cloning, however,
instead of implanting the dividing embryo into a host, its
stem cells are removed and the embryo dies. A cell is
removed from the patient requiring medical treatment. The
nucleus of this cell is removed and inserted into an empty
donor egg. Division is encouraged through the use of
special chemicals or an electric shock just as before. The
resulting embryonic stem cells are then removed from this
embryo and used to treat the patient.

Is This Answer Correct ?    1 Yes 5 No

Post New Answer

More Core Java Interview Questions

Explain yield() method in thread class ?

0 Answers  


Can you use this() and super() both in a constructor?

0 Answers  


Can we have any code between try and catch blocks?

0 Answers  


Explain Big-O notation with an example

1 Answers  


How to sort array of 0 and 1 in java?

0 Answers  






why string is not taking as primitive datatypes but we r taking it as a class? why explain it?

2 Answers   HP, SparkTG,


what is an object and how do you allocate memory to it?

6 Answers   Anshinsoft, Wipro,


A non-static inner class may have object instances that are associated with instances of the class’s outer class. A static inner class does not have any object instances.

0 Answers  


What is a local class in java?

0 Answers  


how we can make a write-only class in java?

0 Answers  


What is break and continue statement?

0 Answers  


What is difference between path and classpath?

0 Answers  


Categories