/home/caleb/ASDV-Java/Assignments/lab16_arrays2_CalebFontenot/src/main/java/com/calebfontenot/lab16_arrays2_calebfontenot/ArrayCopy3.java
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.calebfontenot.lab16_arrays2_calebfontenot;

/**
 *
 * @author caleb
 */
public class ArrayCopy3 {

    public static void main(String[] args)
    {
        int[] sourceArray = {1, 2, 3, 4, 5};
        int[] targetArray = new int[sourceArray.length];
        // Print the source array
        for (int i = 0; i < sourceArray.length; i++) {
            System.out.print(sourceArray[i] + " ");
        }
        System.out.println();
        // Copy the source array to the target array
        System.arraycopy(sourceArray, 0, targetArray, 0, sourceArray.length);
        // Print the target array
        for (int i = 0; i < sourceArray.length; i++) {
            System.out.print(targetArray[i] + " ");
        }
    }
}