write a method that takes a parameter int size and returns an int[] array of that size. code example

Example 1: Write a method that takes a parameter int size and returns an int[] array of that size.

public int[] makeArray(int size)
{
    int[] arr = new int[size];
    for(int i = 0; i < arr.length; i++)
        {
            arr[i] = 0;
        }
        return arr;
}

Example 2: write a method that takes a parameter int size and returns an int[] array of that size.

write a method that takes a parameter int size and returns an int[] array of that size.

Tags:

Java Example