=20
www.javacodegeeks.com/2014/01=E2=80=A6<=
/p>
Here is how I started writing this article. I have read this statement s=
o many times: =E2=80=9CCloning becomes difficult when the object has refere=
nces to mutable final fields.=E2=80=9D And every time I google about it, un=
derstand what exactly this means and as part of the process forget about it=
too. So thought I would blog this so that this will serve as my immediate =
reference. Cloning an object, what I could recall from my OOP course in my =
graduate studies, is creating a similar copy of an object which basically s=
hould conform to the following rules: x.clone() !=3D x x.clon=
e().getClass() =3D=3D x.getClass() x.clone().equals(x) Note that condition =
(1) must always be satisfied in all the cases. Though conditions (2) and (3=
) are not absolute requirements, it is good to design clone method in such =
a way that these hold good. Before going ahead with discussion, here is the=
method signature of clone method in Object class: protected native Object =
clone() throws CloneNotSupportedException; So
Open link
=20