Untitled

mail@pastecode.io avatar
unknown
plain_text
17 days ago
537 B
1
Indexable
Never
import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        // Original array
        int[] originalArray = {1, 2, 3, 4, 5};

        // Creating a copy of the original array
        int[] copyArray = Arrays.copyOf(originalArray, originalArray.length);

        // Displaying the original array
        System.out.println("Original array: " + Arrays.toString(originalArray));

        // Displaying the copied array
        System.out.println("Copied array: " + Arrays.toString(copyArray));
    }
}
Leave a Comment