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 better - 'bit-shift a value' or 'multiply by 2'?
What is meant by method?
What is a ternary operator in java?
What is the difference between class forname and new?
Can we write a class without main method in java?
How is the marker interface used in Java?
Why Java is not pure Object Oriented language?
Why set do not allow duplicates in java?
Why heap memory is called heap?
Can list contain null in java?
Why unicode is important?
What is the purpose of tostring() method in java?
State some advantages of java?
How do we access static members in java?
How does thread synchronization occurs inside a monitor? What levels of synchronization can you apply?