Java Arrays.equals(double[] a, double[] a2)

Syntax

Arrays.equals(double[] a, double[] a2) has the following syntax.

public static boolean equals(double[] a,  double[] a2)

Example

In the following code shows how to use Arrays.equals(double[] a, double[] a2) method.


/* w ww .j ava  2 s .  c  om*/

import java.util.Arrays;

public class Main {

  public static void main(String[] args) {
    
    double[] arr1 = new double[] { 1.2, 1.23 };
    double[] arr2 = new double[] { 1.2, 1.23 };
    double[] arr3 = new double[] { 1.23, 1.2 };
    
    System.out.println(Arrays.equals(arr1, arr2));

    System.out.println(Arrays.equals(arr1, arr3));
  }
}

The code above generates the following result.