1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
|
public class DeepCopy implements Cloneable
{
private int zahl;
private int[] zahlen;
public DeepCopy(int zahl, int[] zahlen)
{
this.zahl = zahl;
this.zahlen = zahlen;
}
public Object clone()
{
int neueZahl = this.zahl;
int[] neueZahlen = new int[this.zahlen.length];
for(int i=0; i<this.zahlen.length; i++)
{
neueZahlen[i] = this.zahlen[i];
}
DeepCopy kopie = new DeepCopy(neueZahl, neueZahlen);
return kopie;
}
}
|