When comparing arrays in Java, are there any differences between the following 2 statements?
Object[] array1, array2;
array1.equals(array2);
Arrays.equals(ar
The Arrays.equals(array1, array2)
:
check if both arrays contain the same number of elements, and all corresponding pairs of elements in the two arrays are equal.
The array1.equals(array2)
:
compare the object to another object and return true only if the reference of the two object are equal as in the Object.equals()