package anli;
public class Test07 {
public static void main(String[] args) {
int[] a = {11, 22, 33, 44, 55, 66, 77};
int[] b = {11, 22, 33, 44, 55, 66, 77};
int[] c = {22,33,4,4,5,5,5};
boolean re = compare(a, b);
System.out.println(re);
boolean res = compare(a,c);
System.out.println(res);
}
public static boolean compare(int a[], int b[]) {
if (a.length != b.length) {
return false;
}
for (int i = 0; i < a.length; i++) {
if (a[i] != b[i]) {
return false;
}
}
return true;
}
}
判断数组内容相同
最新推荐文章于 2023-11-17 15:32:12 发布