JAVA copyarray
- package firstjava;
- public class Array {
- public static void main(String[] args) {
- int[]sourceArray = {2, 3, 1, 5, 10 };
- int[]targetArray = {3, 2, 1, 2, 3};
- System.arraycopy(sourceArray, 0, targetArray, 0, sourceArray.length);
- int i;
- for ( i=0 ; i< sourceArray.length ; i++ )
- {
- System.out.println(sourceArray[i] + " copy " + targetArray[i]);
- }
- }
- }
arraycopy ( sourceArray , srcPosition , targetArray , tarPosition , length)
留言
張貼留言