public class Test {
    public static void change(char[] a){
        a[0] = '1';
        a[1] = '2';
    }
    public static void main(String args[]){
        char[] a = new char[]{'a','b'};
        change(a);
        System.out.println(a);
    }
}
The output is 12
public class Test {
    public static void change(char[] a){
        a = new char[]{'1','2'};
    }
    public static void main(String args[]){
        char[] a = new char[]{'a','b'};
        change(a);
        System.out.println(a);
    }
}
The output is ab. I understand I am missing something about the way java passes method arguments. I understand references to objects are passed by value. However, I cannot reconcile what I understand with the results of these programs.
 
     
     
     
     
     
    