why copying object in java is not working?
<p>I have to copy an object by value not by reference, I tried different methods, none is working. please take a look at this code :</p>

<p>public static class25 copy(class25 otherSpec) {
    class25 class2 = new class25( otherSpec.Getfct());</p>

<pre><code>for (pa pack : otherSpec.Getfct())
    class2.addsp(pack);
for (dn ddata : otherSpec.getdld())
    class2.addsp(data);

return class2;
</code></pre>

<p>}
and there is it's use:</p>

<p>class25 class22 = class25.copy(class2);</p>
