the first method doesn't change the array, but the second method changes or swaps the given indexes of the array , why? :
public class Main{
public static void changeArr1 (int [] arr) { //doesn't do anything?
int [] tmp = {10, 20};
arr = tmp;
}
public static void swap(int[] arr,int i,int j){ //swapping 2 array elements?
int temp = arr[i];
arr[i] = arr[j]
arr[j] = temp;
}
}