Arrays do not override the Object.equals()
method; rather, the implementation of the equals()
method compares an array's references rather than its contents. To compare the contents of two arrays, use the two-argument Arrays.equals()
method isnteadinstead. When intentionally testing reference equality, use the reference equality operators, ==
and !=
. Inappropriate use of the equals()
method can lead to unexpected results.
...