subject

In this program why can arrays values stored in index be changed in both main method and mystery method, when the array is declared in main as a local variable? when the array is printed in the main method, the chnage took in the mystery method is present, why is this? is it a property of arrays?
public class referencemystery {
public static void main(string[] args) {
int x = 0;
int[] a = new int[4];
x = x + 1;
mystery(x, a);
system. out. println(x + " " + arrays. tostring(a));
x = x + 1;
mystery(x, a);
system. out. println(x + " " + arrays. tostring(a));
}
public static void mystery(int x, int[] a) {
x = x + 1;
a[x] = a[x] + 1;
system. out. println(x + " " + arrays. tostring(a));
}
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 09:00
Which best compares appointments and events in outlook 2010appointments have a subject man, and events do notappointments have a specific date or range of dates, and events do notappointments have a start and end time of day, and events do notappointments have a location option, and events do not
Answers: 2
question
Computers and Technology, 23.06.2019 14:30
Which of the following would not be considered a pc? a. mainframe b. desktop c. tablet pc d. laptop
Answers: 2
question
Computers and Technology, 23.06.2019 15:30
The processing of data in a computer involves the interplay between its various hardware components.
Answers: 1
question
Computers and Technology, 24.06.2019 16:00
Your is an example of personal information that you should keep private.
Answers: 2
You know the right answer?
In this program why can arrays values stored in index be changed in both main method and mystery met...
Questions
question
History, 02.09.2019 11:10
question
History, 02.09.2019 11:10
question
Mathematics, 02.09.2019 11:10
Questions on the website: 13722362