Arrays equals in java

By | August 23, 2020

Arrays equals in java:

Arrays.equals() method returns true if the two specified arrays of longs are equal to one another. 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. In other words, two arrays are equal if they contain the same elements in the same order. Also, two array references are considered equal if both are null.

Parameters:
a – one array to be tested for equality
a2 – the other array to be tested for equality
Returns:
true if the two arrays are equal
false if the two arrays are not equal

Example 1:

Example 2:

 

Recommended Posts:

Java map examples

Find the third largest number in an array in Java

Star pattern programs in Java

arrays tostring in java | selenium interview questions

 

 

 

 

 

Tags: Arrays equals in java

 

Leave a Reply

Your email address will not be published. Required fields are marked *