Arrays fail to do not override class Object
's equals()
method; the implementation of the equals()
method applied to arrays compares the array references rather than the contents of the arrays. Use the two-argument Arrays.equals()
method to compare the contents of arrays. When intentionally testing reference equality, prefer use the reference equality operators, ==
and !=
; inappropriate use of the equals()
method may lead to unexpected results.
...