Answers were Sorted based on User's Feedback
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
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
|Is This Answer Correct ?||4 Yes||2 No|
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|
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|
Can we use different return types for methods when overridden?
Explain oops concepts in detail?
Which package is used for pattern matching with regular expressions?
Which method will get invoked first in a stand alone application?
What is callable java?
What is subsequence of a string?
What is serialVersionUID and what is its need?
What is difference between word and integer?
What are the uses of final, finally and finalize in java?
Explain about wait() method?
Can java list contain duplicates?
What is a final class in java?