I am given these 2 methods and when i run question8 it prints out "1 3" but I don't understand why. Shouldn't the doSomething method not affect the "arr" array in the question8 method and therefore print out "2 4"
private static void question8() {
int[] arr = {1,2,3,4};
doSomething(arr);
System.out.print(arr[1] + " ");
System.out.print(arr[3]);
}
private static void doSomething(int[] list) {
int[] b = list;
for (int i = 0; i < b.length; i++) {
b[i] = i;
}
}