public class test2 {
public static void main(String[] args) {
// TODO Auto-generated method stub
method1();
}
public static void method1(){
int[] a={1,2,3,0};
boolean b=false;
for(int i=0;i<a.length;i++){
for(int j=i+1;j<a.length;j++){
b=false;
if(a[i]==a[j]){
b=true;
break;
}
}
if(b){
break;
}
}
if(b){
System.out.println("本数组有相同元素");
}else{
System.out.println("本数组没有相同元素");
}
}
}