One of your problems why the "invalid assignment operator" error is showing up is because you can't do this in java
int[] a =new int[1,2]; // will give you a compiler error.
the parameter inside the square bracket actually means the size of the array.
int[] a=new int[2];
here 2 means the size of the array 'a'.
if you want to declare the contents for the array, do this
int[] a=new int[2]{1,2};
this is exactly what you need ...where the value inside the square bracket tells the compiler the size of the array 'a' and the values inside the curly braces tells the contents what those are the two contents of the given array 'a'.
And you dont need new operator to or the class name itself to call a method within the class. Just do a
addarr(a,b);
to call the function and your function would be invoked.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…