Monday, August 20, 2018

How do you check the equality of two arrays in java?




package com.ceo2a.test;

import java.util.Arrays;

public class Test {

public static void main(String[] args) {
int[] arr1={5,6,9};
int[] arr2={6,5,9};
int[] arr3={5,6,9};
System.out.println("arr1 == arr2 ? "+Arrays.equals(arr1, arr2));
System.out.println("arr1 == arr3 ? "+Arrays.equals(arr1, arr3));
}
}






How do you check the equality of two arrays in java?
How do you check the equality of two arrays in java?





Share this

1 Response to "How do you check the equality of two arrays in java?"