GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Tech FAQs  >  Programming  >  Java

 Print  |  
Question:  

As of now ,what i know abt cloning is that we can make a field to field copy of an object.ie when we clone an object,its state as well as a its behaviour is copied to the cloned object.

My question is what is the neccesity of it? cant we create another object of the same class? so how does its different from cloned object (that is creating another object of that class rather than  being cloned).

is there any security issues coupled with this cloned object? And What is the Concrete purpose of Cloning?





June 06, 2009 20:26:05 #2
 kjwilde   Member Since: June 2009    Total Comments: 1 

RE: As of now ,what i know abt cloning is that we can make a field to field copy of an object.ie when we clone an object,its state as well as a its behaviour is copied to the cloned object.My question is what is the neccesity of it? cant we create another
 
Creating a new instance of the same class and then being sure to apply all attributes of the original object to the new object would be equivalent to cloning. The clone method takes the legwork out of getting a duplicate of an object.
     

 

Back To Question