package text; public class asd { public void output(String arrayName,int temp[]){ int i; for(i=0;i<temp.length;i++){ System.out.println(arrayName +"["+i+"]="+temp[i]); } } public static void main(String[] args){ int i; int source[]={1,2}; String arrayName; asd a=new asd(); int dest1[]=new int[2]; for(i=1;i<source.length;i++){ dest1[i]=source[i]; } arrayName="dest1"; a.output(arrayName,dest1); int dest2[]=(int[])source.clone(); arrayName="dest2"; a.output(arrayName,dest2); int dest3[]=new int[2]; System.arraycopy(source,0,dest3,0,2); arrayName="dest3"; a.output(arrayName,dest3); } } dest1[0]=0 dest1[1]=2 dest2[0]=1 dest2[1]=2 dest3[0]=1 dest3[1]=2