Jan 30

The Arrays class includes methods for testing the equality of two array. Two arrays are considered equal if both arrays contain the same number of elements, and all corresponding pairs of elements in the two arrays are equal.

if (Arrays.equals(array1, array2))
{
  // array1 and array2 contain the same elements in the same order
}

written by objects \\ tags: , ,


2 Responses to “How to check if two Java arrays are equal?”

  1. inder Says:

    no its not working error

  2. objects Says:

    Need some more details about how its not working

Leave a Reply

You must be logged in to post a comment.