CopyArrays
import java.util.Arrays;
public class CopyArrays
{
public static void main(String args[])
{
int []a = {1, 2, 3, 4, 500, 600, 700, 800};
int [] b,c,d;
System.out.println(Arrays.toString(a));
b = Arrays.copyOf(a,a.length);
System.out.println(Arrays.toString(b));
c = Arrays.copyOf(a,4);
System.out.println(Arrays.toString(c));
d = Arrays.copyOfRange(a,4,a.length);
System.out.println(Arrays.toString(d));
c [3] = -100;
int []tom = Arrays.copyOf(c, 6);
System.out.println(Arrays.toString(tom));
d [d.length-1] = -200;
int []jerry = Arrays.copyOfRange(d,1,8);
System.out.println(Arrays.toString(jerry));
System.out.println(Arrays.toString(a));
/*System.out.println('C'+Arrays.toString(c)+'\t');
System.out.println('d'+Arrays.toString(d)+'\t');*/
}
}
posted on 2017-10-20 22:40 MACHINE_001 阅读(155) 评论(0) 编辑 收藏 举报