What is object cloning
Answers were Sorted based on User's Feedback
Answer / anurag sharma
loning is a process to copying all fields from one
object
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / me
A bit of background information. Because the way memory
works (long story), an object consists of two things, the
reference which is basically a pointer, or a label that is
used to access the object, and the actual object data,
which is stored elsewhere (search Google for explanations
on memory stacks and heaps).
If you would simply copy an object, you would only copy the
reference. So what you end up with, are two references that
point to exactly the same data. When you change the
original object, the copy object gets changed as well, and
visa versa.
If that's not what you want, you have to clone the object,
which means you actually create a new object in memory,
that holds a copy of the data of the original object, and
you also create a new reference that points to this new
object.
When you then change some value in the original object, the
copy object stays unchanged.
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / nashiinformaticssolutions
An ability to recreate an object entirely similar to an existing object is known as Object Cloning in Java. Java provides a clone() method to clone a current object offering the same functionality as the original object.
| Is This Answer Correct ? | 0 Yes | 0 No |
Name the numeric constants representing max, min values?
What is 'use strict'?
What does break and continue statements do in javascript?
What is "strict mode" and how is it used in JavaScript?
What is the difference between scripting and programming?
Write the code for adding new elements dynamically?
How to define a named function in JavScript?
Which javascript framework is in demand?
What does 3+4+"7" evaluate to?
Are there any predefined constant provided by the browser with the key code values that can be reused?
How can I learn javascript fast?
What is the source code for include() & forwrd() method servlet program?