/* Compare whether the two arrays are identical.
1. Compare whether the length is equal.
2. Check whether the comparison elements are equal.
3. Compare whether the element sequence is equal.
If all values are passed, the two arrays are identical.
*/
Public class testarray {
Public static void main (string [] ARGs ){
Int [] arr1 = new int [] {, 3 };
Int [] arr2 = new int [] {, 3 };
Int m = 0;
Int n = 0;
If (arr1.length! = Arr2.length ){
System. Out. println ("the array length is not equal" + "\ n Array 1:" + arr1.length + "\ n Array 2:" + arr2.length );
Return;
}
For (INT I = 0; I <arr1.length; I ++ ){
M + = arr1 [I];
N + = arr2 [I];
}
If (M! = N ){
System. Out. println ("array elements are different ");
Return;
}
For (INT I = 0; I <arr1.length; I ++ ){
M = arr1 [I];
N = arr2 [I];
If (M! = N ){
System. Out. println ("the order of array elements is not equal" + "\ n not equal index number:" + I );
Return;
}
}
System. Out. println ("Two arrays are identical ");
}
}
// The array content in the instance is manually written, and the computer can generate a random number and then compare it.
Compare whether the two arrays are identical