what is the use of clone() in real time scenario?
Answer Posted / aravindareddy
Clone() method is used to create and return copy of the
object,The Cloneable interface defines a method called Clone
(), which can be used to clone an object in your java
program.The reason for making a copy of an object is if
you’re going to modify that object and you don’t want to
modify the caller’s object. If you decide that you want to
make a local copy, you simply use the clone() method to
perform the operation.
| Is This Answer Correct ? | 28 Yes | 7 No |
Post New Answer View All Answers
Are arrays classes in java?
Why there are some null interface in java? What does it mean?
Why is java so important?
What is the purpose of an interface?
When is update method called?
What is a class in java?
What is return keyword in java?
What is the primitive type byte?
Does isempty check for null?
What do you mean by inner class in java?
Is math an abstract class in java?
What is instance synchronization?
What are variable arguments or varargs?
Can I import same package/class twice?
Differentiate between postfix and prefix operators in java.