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