Java中数组赋值


1,数组操作中,可以使用等于(=)赋值,注意:此时新数组只是指向原数组的存储空间,并没有重新申请新的空间。

2,第二种使用System.ararycopy方法

System.arraycopy(originalArray, 0, targetArray, 0, originalArray.length);
此时,新数组重新申请存储地址空间,再将原数组中数据拷贝过来。

猜你喜欢

转载自blog.csdn.net/hc1017/article/details/80985904