how to copy some of a object array to another object array
i have a class like this
class sd{
String a="";
String b="";
String c="";
String d="";
int lenph=12;
boolean s=false;
}
and two array like this
sd[] stexp=new sd[12];
sd[] st=new sd[3];
i want to copy 3 of stexp to st how can i do that?
i do this but its not working
sd[] stexp=new sd[12];
for(int c=0;c<stexp[0].lenph;c++){
stexp[c]=new sd();
}
sd[] st=new sd[3];
for(int c=0;c<3;c++){
st[c]=new sd();
}
for(int i=0;i<12;i++){
stexp[i].a="f"+i;
stexp[i].b="f"+i;
stexp[i].c="f"+i;
stexp[i].d="f"+i;
}
for(int i=0;i<3;i++){
st[i].a=stexp[i].a;
st[i].b=stexp[i].b;
st[i].c=stexp[i].c;
st[i].d=stexp[i].d;
}
b+=st[0].a+"\n";
b+=st[0].b+"\n";
b+=st[0].c+"\n";
b+=st[0].d+"\n";
sho.setText("b="+b);
thanks for any help. :)
opps i changed wrong codes .
i want to copy a object array to another object array and i do with
System.arraycopy(stexp, 0,st , 0, 1);
but when i running the codes in eclipse its not working.