美罗城厕所qvod,龙淇姝,cali holi
此处使用int[]数组示范
public static void main(string[] args) {
int[] arry={1,10,5,8,11,100,99,10};
//用于判断是否有重复值的标记
boolean flag=false;
for (int i = 0; i < arry.length; i++) {
int temp=arry[i];
int count=0;
for (int j = 0; j < arry.length; j++) {
int temp2=arry[j];
//有重复值就count+1
if(temp==temp2){
count++;
}
}
//由于中间又一次会跟自己本身比较所有这里要判断count>=2
if(count>=2){
flag=true;
}
}
if(flag){
system.out.println("有重复值存在!!!");
}else{
system.out.println("没有重复值存在!!!");
}
}
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!!
点击进行留言回复
网友评论