Question: Consider the following method changeArray. An array is created that contains (2, 8, 10, 9, 6} and is passed to changeArray What are the contents

 Consider the following method changeArray. An array is created that contains

Consider the following method changeArray. An array is created that contains (2, 8, 10, 9, 6} and is passed to changeArray What are the contents of the array after the changeArray method executes? public static void changeArray (int [] data) {for (int k = data.length - 1; k > 0; k--) data [k - 1] = data [k] + data [k - 1];} (A) {2, 6, 2, -1, -3} (B) {-23, -21, -13, -3, 6} (C) {10, 18, 19, 15, 6} (D) This method results in an indexOutBounds exception. (E) {35, 33, 25, 15, 6}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!