Menu
Question Index
...

Write a program to create a copy of the input array.

Input (Integer Array) Output (Integer Array)
{2, 3, 4, 7, 6, 1} {2, 3, 4, 7, 6, 1}
{3, 9, 1, 5, 16, 10} {3, 9, 1, 5, 16, 10}



class CopyArray
{
    public static void main(String s[])
    {
        int[] input = {4, 6, 19, 2, 7, 12, 1, 9};
        int[] copy = copyArray(input);
        System.out.print("The copy of the array is : ");
        for(int element : copy)
        {
            System.out.print(element + ", ");
        }

    }


    public static int[] copyArray(int[] input)
    {
        int[] output = null;
        return output;
    }

}

Doubts

Problems

Topic: For-each Loop In Core Java Programming

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App