/*
 * 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 ArrayCopy1 {

    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
        for (int i = 0; i < sourceArray.length; i++) {
            targetArray[i] = sourceArray[i];
        }
        // Print the target array
        for (int i = 0; i < sourceArray.length; i++) {
            System.out.print(targetArray[i] + " ");
        }
    }
}
