Consider array items, which contains the values 0, 2, 4, 6 and 8. If method changeArray is called with changeArray(items, items[2]), what values are stored in items after the method has finished executing? public static void ChangeArray(int[] passedArray, int value) { passedArray[value] = 12; value = 5; }

a. 0, 2.5, 6. 12
b. 0, 2, 12, 6, 8
c. 0,2, 4, 6, 5
d. 2 46, 12

Respuesta :

ijeggs

Answer:

Non of the given options is correct.... The values stored in the array after the method ChangeArray(items,items[2]) is called are 0, 2, 4, 6, 12

Explanation:

See complete java code and output below:

import java.util.Arrays;

import java.util.Scanner;

public class ANot {

   public static void main(String[] args) {

   int [] newarr = {0, 2, 4, 6,8};

       ChangeArray(newarr, newarr[2]);

       System.out.println(Arrays.toString(newarr));

}

   public static void ChangeArray(int[] passedArray, int value) {

       passedArray[value] = 12;

       value = 5;

   }

}

Ver imagen ijeggs