allocating memory to an object of a class
<p>I have a list with class objects say </p>

<pre><code>List a[10];

class Hello extends abc implement xyz
{ 
String mesg1;
String mesg2;
Object c;
Goodbye d;
// also their getter setters
}
</code></pre>

<p>a[5] contains objects of Hello class</p>

<p>I have to copy object Instance at postion 1 then do some changes in mesg1 and mesg2  and insert it in the same list in the end.I m trying to do so, but as we know its only the reference that is stored there so i end up changing the mesg1 and mesg2 at position 1 too. </p>

<p>any suggestions ?
 i tried using clone() but cannot make changes to this class or the Hello class.</p>
