system.arraycopy方法使用

老子叫甜甜 提交于 2020-01-26 03:11:17

数组复制

Object[] listSource=Arrays.asList("a","b","c","d").toArray();
        Object[] listDest=Arrays.asList("e","f","g","h","k").toArray();


        System.arraycopy(listSource,2,listDest,3,2);

        System.out.println(Arrays.asList(listSource));
        System.out.println(Arrays.asList(listDest));

输出:

[a, b, c, d]
[e, f, g, c, d]

参数分析:

    * @param      src      the source array.
     * @param      srcPos   starting position in the source array.
     * @param      dest     the destination array.
     * @param      destPos  starting position in the destination data.
     * @param      length   the number of array elements to be copied.

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!