Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Ayden Smith   on Nov 21 In Java Category.

  
Question Answered By: Brent Brown   on Nov 21

one should not use the clone  method from within the class  itself. clone
is used when u want to create identical replicas of the same object  in
some other class not the same class. even though u may be able to do
that, it is not the right way of doing it.

there are cleaner ways of doing this. the problems u r facing could be
because u r passing references to ur constructor  inside clone method  and
when u modify the values of these references all the values are changed
in the new and the old object

try to avoid the clone stuff if this is what u want to accomplish.

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on calling constructor Or get search suggestion and latest updates.


Tagged: