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


Please Help Members By Posting Answers For Below Questions

What is the purpose of stub and skeleton?

550


In case of inheritance what is the execution order of constructor and destructor?

644


What is a map in java?

557


What is the use of parseint in java?

543


What is the difference between a switch statement and an if statement?

520






Explain the difference between string, stringbuffer and stringbuilder in java?

565


Which is bigger float or double java?

528


What is the java idl system?

587


Why can't you declare a class as protected?

604


How many bits is a char?

539


what is meant by HQL?

647


What is the new line character?

564


Which is faster call by value or call by reference?

506


Which is fastest collection in java?

566


How do I stop concurrentmodificationexception?

515