I wonder why the output is still 1,2,3,4,5
, since if I change a value in doIt
(for example : z[0] = 10
), the array is changed.
public class Main
{
public static void main(String[] args) {
int[] array = {0,1,2,3,4,5};
testIt.doIt(array);
for(int i=0;i<array.length;i++){
System.out.println(array[i]);
}
}
}
class testIt
{
public static void doIt(int [] z){
z = null
}
}