Consider the following method: public static void arrayMystery(int[] array) { for (int i = 0; i < array.length - 1; i++) { if (array[i] < array[i + 1]) { array[i] = array[i + 1]; } } } Indicate what values would be stored in the array after the method arrayMystery executes if each integer array below is passed as a parameter to it. a. input = {2, 4} b. input = {1, 3, 6} c. input = {7, 2, 8, 4} d. input = {5, 2, 7, 2, 4} e. input = {2, 4, 6, 3, 7, 9}

Respuesta :

Answer:

a. input={4,4}

b. input={3,6,6}

c. input={7,8,8,4}

d. input={5,7,7,4,4}

e input={4,6,6,7,9,9}

Explanation:

First understanding the method in the method we are iterating over array upto the second last element and in the loop we are checking that the current element is less than then next array element if it is less then we are assigning the value of next element to the current element.So the outputs are stated above according to the method execution.

ACCESS MORE