/home/caleb/ASDV-Java/Assignments/lab16_arrays2_CalebFontenot/src/main/java/com/calebfontenot/lab16_arrays2_calebfontenot/ArrayCopy3.java |
package com.calebfontenot.lab16_arrays2_calebfontenot;
@author
public class ArrayCopy3 {
public static void main(String[] args)
{
int[] sourceArray = {1, 2, 3, 4, 5};
int[] targetArray = new int[sourceArray.length];
for (int i = 0; i < sourceArray.length; i++) {
System.out.print(sourceArray[i] + " ");
}
System.out.println();
System.arraycopy(sourceArray, 0, targetArray, 0, sourceArray.length);
for (int i = 0; i < sourceArray.length; i++) {
System.out.print(targetArray[i] + " ");
}
}
}