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