public class Foo {
public static void change(int[] arr){
    arr = null;
}
public static void change2(int[] arr){
    arr[0] = 99;
}
public static void main (String[] args){
    int[] arr = {1,2,3,4,5};
    change(arr);
    System.out.println("it should null: "+Arrays.toString(arr));
    change2(arr);
    System.out.println("updated array : "+Arrays.toString(arr));
}   }
CONSOLE OUTPUT
it should null: [1, 2, 3, 4, 5]
 updated array: [99, 2, 3, 4, 5]
I need to get understanding about pass by reference as i passed int[ ] to first method i.e change() it does not null the array as per my understanding it should change to NULL as array references are pass by reference but if i pass array to second method i.e change2() it changed the value at specific index. It means that reference is being passed.
 
     
    