Java Array class equals(double[] a, double[] a2) example
Array class equals(double[] a, double[] a2) method example
Array class equals(double[] a, double[] a2)method example. This example shows you how to use equals(double[] a, double[] a2)method.This method Returns true if the two specified arrays of doubles are equal to one another.
Here is the code:-
/**
* @Program that Returns true if the two specified arrays of doubles are equal
* to one another.
* equals4Array.java
* Author:-RoseIndia Team
* Date:-16-May-2008
*/
import java.util.*;
public class equals4Array {
public static void main(String[] args) {
//creating a double array
double d[]={4.56,5.45,3.56,6.78,9.87};
//Creating a second array
double d1[]={4.56,5.45,3.56,6.78,9.87};
//Returns true if the two specified arrays of doubles are equal
boolean b=Arrays.equals(d,d1);
System.out.println("The two specified arrays of doubles are equal:-" +b);
}
} |
Output of the program:-
| The two specified arrays of doubles are equal:-true |
|