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
What is an infinite loop in java? Explain with an example.
What is a parameter in java?
What is an object in java and how is it created?
Why is string buffer better than string ?
Java Compiler is stored in JDK, JRE or JVM?
Explain the overview of UDP messaging.
What is the difference between comparison done by equals method and == operator?
What is the use of :: in java?
What is the primitive type short?
What is the SimpleTimeZone class?
What is volatile keyword in java
What is the exception hierarchy in java?
What is a ternary operator in java?
What do you understand by private, protected and public?
How many bytes is a string in java?