The field ary1 was never initialized in your constructor. It therefore takes the default value of null. Note that this.ary1 != ary1 passed to the constructor as a parameter.