Limited access

Upgrade to access all content for this subject

Consider the following method.

// Change each number evenly divisible by 7 to a 7
public static int[] change7(int[] numbers)
{
    for (int num : numbers)
    {
        if (num%7 == 0)
        {
            num=7;
        }
    }
    return numbers;
}

What will happen when the following call to change7 is made?

int[] numbers = {15, 20, 21, 23, 12, 21};
change7(numbers);
A

numbers will contain {15, 20, 21, 23, 12, 21};

B

numbers will contain {15, 20, 7, 23, 12, 7};

C

numbers will contain {15, 20, 7, 23, 12, 21};

D

numbers will contain {15, 20, 21, 23, 12, 7};

E

An error will be thrown.

Select an assignment template