selectsort排序方法反思
重点:引用类型变量的数组如何交换
错误代码:
for(int index = 0;index < shapes.length - 1 ;index++){
// int aimNum = shapes[index].getC();
Shape aimShape = shapes[index];
for(int scan = index + 1;scan < shapes.length;scan++){
if(compare(aimShape ,shapes[scan])){
aimShape = shapes[scan];
}
}//如何进行交换
temp = shapes[index];
shapes[index] = aimShap
共有 0 条评论