How to check whether two arrays are equal using the arrays class in Java

1 Answer

0 votes
public class MyClass {
    public static void main(String args[]) {
        int[] arr1 = {1, 2, 3, 4};
        int[] arr2 = {1, 2, 3, 4};
        
        System.out.println(java.util.Arrays.equals(arr1, arr2));
    }
}



/*

run:

true

*/

 



answered Jul 21, 2019 by avibootz

Related questions

...