Question: Consider the following method, mystery: What are the values of the elements in array a1 after the following code executes? int[] a1 = {1, 3,

Consider the following method, mystery:

public static void mystery (int [] a, int [] b) { for (int i = 0; i < a.length; i++) { a[i] += b[b.length - 1 i);

What are the values of the elements in array a1 after the following code executes?

int[] a1 = {1, 3, 5, 7, 9};

int[] a2 = {1, 4, 9, 16, 25};

mystery(a1, a2);

public static void mystery (int [] a, int [] b) { for (int i = 0; i < a.length; i++) { a[i] += b[b.length - 1 i);

Step by Step Solution

3.28 Rating (169 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

After the mystery metho... View full answer

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 Building Java Programs A Back to Basics Approach Questions!