深入java数组:type[] copyOf(type[] original, int length)
时间:2014-04-13 09:09 来源: 我爱IT技术网 作者:微风
type[] copyOf(type[] original, int length)
功能:将数组copy到另一数组
注意:如果缺少length参数会编译期报错
例子:
int[] a2 = new int[]{3, 4 , 6, 5};
//int[] copy = Arrays.copyOf(a2, 2); // [3,4]
//int[] copy = Arrays.copyOf(a2, 4); // [3,4,5,6]
//int[] copy = Arrays.copyOf(a2, 6);// [3,4,5,6,0,0]
本文来源 我爱IT技术网 http://www.52ij.com/jishu/4975.html 转载请保留链接。
- 评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
-
