I want to compare the values of two arrays of type Integer. I get the wrong answer when I compare their exact values, and the correct answer when I compare them with Arrays.equals:
Integer a[]=new Integer[2];
Integer b[]=new Integer[2];
a[0]=138;
a[1]=0;
b[0]=138;
b[1]=0;
boolean c;
c=a[0]==b[0];//c is false
c=Integer.valueOf(a[0])==Integer.valueOf(b[0]);//c is false
c=Arrays.equals(a, b);//c is true