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 the disadvantage of synchronization?
What is constructor chaining and how is it achieved in java?
Is stringwriter thread safe?
What is finalize method?
What is nan in java?
What is a boolean output?
How to do encapsulation in java?
Which is better stringbuffer or stringbuilder?
Can a class have more than one object?
What are java threads?
2) Suppose there are 5 directories having lot of files (say txt files) in each directory. 2 things :- 2.1) You want to search for filenames which have a particular pattern. 2.2) Out of these filtered files you want to search for a particular keyword or a search string. How can you achieve this?
What are aggregate functions explain with examples?
What is ++ a in java?
Is alive method in java?
What is Java Annotations?