Java Arrays.deepEquals(Object [] a1, Object [] a2)

Syntax

Arrays.deepEquals(Object [] a1, Object [] a2) has the following syntax.

public static boolean deepEquals(Object [] a1,   Object [] a2)

Example

In the following code shows how to use Arrays.deepEquals(Object [] a1, Object [] a2) method.


// www. ja  v a2s  .  c  om
import java.util.Arrays;

public class Main {

  public static void main(String[] args) {
    Object[] b1 = new Object[] { 'a', 'b' };
    Object[] b2 = new Object[] { 'a', 'b' };
    Object[] b3 = new Object[] { 'x', 'y' };

    System.out.println(Arrays.deepEquals(b1,b2));
    
    System.out.println(Arrays.deepEquals(b1,b3));  
  }
}

The code above generates the following result.