public class Px {public static void main(String[] args) {
int[]a = new int[]{20,10,1,5,4,78,96,56,6,11};
for(int i=0;i<=a.length-1;i++){
for(int j=0;j<=a.length-i-1 ;i++){
if(a[j]>a[j+1]){
int temp=0;temp = a[j];a[j]=a[j+1];a[j+1]=temp;
}
}
}
for(int i=0;i<a.length;i++){System.out.println(a[i]);
}
}
}
哪儿出错了?怎么不会排序?求指点
int[]a = new int[]{20,10,1,5,4,78,96,56,6,11};
for(int i=0;i<=a.length-1;i++){
for(int j=0;j<=a.length-i-1 ;i++){
if(a[j]>a[j+1]){
int temp=0;temp = a[j];a[j]=a[j+1];a[j+1]=temp;
}
}
}
for(int i=0;i<a.length;i++){System.out.println(a[i]);
}
}
}
哪儿出错了?怎么不会排序?求指点