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