Clone() vs Copy constructor- which is recommended in java -



Clone() vs Copy constructor- which is recommended in java -

this question has reply here:

clone() vs re-create constructor vs mill method? 7 answers

clone method vs re-create constructor in java. 1 right solution. utilize each case?

clone broken, dont utilize it.

the clone method of object class magical method no pure java method ever do: produces identical re-create of object. has been nowadays in primordial object superclass since beta-release days of java compiler*; , it, ancient magic, requires appropriate incantation prevent spell unexpectedly backfiring

prefer method copies object

foo copyfoo (foo foo){ foo f = new foo(); //for properties in foo f.set(foo.get()); homecoming f; }

read more http://adtmag.com/articles/2000/01/18/effective-javaeffective-cloning.aspx

java clone copy-constructor

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -