Question: Consider the following method, mystery2: What are the values of the elements in array a1 after the following code executes? int[] a1 = {2, 4,
Consider the following method, mystery2:
![public static void mystery2 (int [] a, int[] b) { for (int i = 0; i < a.length; i++) { %3D a[i] = a[2 * i % a.length] - b[3 * i % b.length];](https://dsd5zvtm8ll6.cloudfront.net/si.question.images/images/question_images/1606/8/9/3/7455fc740b11234b1606893745299.jpg)
What are the values of the elements in array a1 after the following code executes?
int[] a1 = {2, 4, 6, 8, 10, 12, 14, 16};
int[] a2 = {1, 1, 2, 3, 5, 8, 13, 21};
mystery2(a1, a2);
public static void mystery2 (int [] a, int[] b) { for (int i = 0; i < a.length; i++) { %3D a[i] = a[2 * i % a.length] - b[3 * i % b.length];
Step by Step Solution
3.51 Rating (161 Votes )
There are 3 Steps involved in it
After the mystery2 method ... View full answer
Get step-by-step solutions from verified subject matter experts
