How do you check if two arrays are equal in Java?

Last Updated :
Discuss
Comments

How do you check if two arrays are equal in Java?


arr1 == arr2

Arrays.equals(arr1, arr2)

arr1.equals(arr2)


arr1.compare(arr2)

Share your thoughts in the comments