Comparing 2 int arrays
<p>Can anyone tell me whats wrong in this method and why it gives a nullpointerException ?</p>

<pre><code>public boolean check(){

    Scanner scan = new Scanner(System.in);

    int[] arr1 = new int []{1,2,3};
    int[] arr2 = new int[]{};

    for(int i = 0;i&lt;arr1.length;i++)
    {
        System.out.println("Enter numbers to check");
        arr2[i] = scan.nextInt();
    }

    if(arr1 == arr2)
        return true;

    return false;
}
</code></pre>
