subject

Public static void arraymystery(int[] a) {
for (int i = 1; i < a. length - 1; i++) {
a[i] = a[i - 1] - a[i] + a[i + 1];
}
}
indicate in the right-hand column what values would be stored in the array after the method arraymysteryexecutes if each integer array below is passed as a parameter to it.

int[] a1 = {42, 42};
arraymystery(a1);

int[] a2 = {6, 2, 4};
arraymystery(a2);
int[] a3 = {7, 7, 3, 8, 2};
arraymystery(a3);

int[] a4 = {4, 2, 3, 1, 2, 5};
arraymystery(a4);

int[] a5 = {6, 0, -1, 3, 5, 0, -3};
arraymystery(a5);

i know the answers are:

{42, 42}

{6, 8, 4}

{7, 3, 8, 2, 2}

{4, 5, 3, 4, 7, 5}

{6, 5, 9, 11, 6, 3, -3}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 04:30
Which of the statements below is true? the formatting, standard, and drawing commands are unavailable. the formatting, standard, and drawing commands have been used. the formatting, standard, and drawing toolbars are displayed. the formatting, standard, and drawing toolbars are hidden.
Answers: 1
question
Computers and Technology, 23.06.2019 00:30
If joey was single and his taxable income was $9,500, how much would he pay in taxes each year?
Answers: 1
question
Computers and Technology, 23.06.2019 04:10
2pointswho was mikhail gorbachev? oa. a russian leader who opposed a coupob. a polish leader who founded the labor union "solidarityoc. a soviet leader who called for a closer relationship with the unitedstates, economic reform, and a more open societyd. a soviet leader who called for more oppression in the soviet union
Answers: 3
question
Computers and Technology, 23.06.2019 22:30
Apart from confidential information, what other information does nda to outline? ndas not only outline confidential information, but they also enable you to outline .
Answers: 1
You know the right answer?
Public static void arraymystery(int[] a) {
for (int i = 1; i < a. length - 1; i++) {
Questions
question
Biology, 01.03.2021 17:30
question
Mathematics, 01.03.2021 17:30
question
Mathematics, 01.03.2021 17:30
question
Mathematics, 01.03.2021 17:30
Questions on the website: 13722365