Not able to give inputs to a function java.
<p>In this example, i want to add the contents of the two arrays, but I am not able to get how should the input be given. For example, in this case, "invalid assignment operator" error is showing up, for the line int[] a = new int[1,2]. I want to know how to call the function addarr, using the arrays a and b. </p>

<p>public class arradd {</p>

<pre><code>public static void main(String[] args) {
    // TODO Auto-generated method stub
    int[] a = new int[1,2];
    int[] b = new int[3,4];
    new arradd.addarr(a,b);
}

public void addarr(int[] arr1, int[] arr2){
    int total = 0;
    for(int i = 0; i &lt; arr1.length; i++){
        total += arr1[i];
    }
    for(int i = 0; i &lt; arr2.length; i++){
        total += arr2[i];
    }
    System.out.println(total);
}
</code></pre>

<p>}</p>