before sorting, a = [[i = 2, j = 9], [i = 78, j = 28], [i = 12, j = 24], [i = 38
, j = 30], [i = 35, j = 78], [i = 75, j = 34], [i = 71, j = 30], [i = 77, j = 88
], [i = 27, j = 34], [i = 69, j = 66]]
after sorting, a = [[i = 35, j = 78], [i = 77, j = 88], [i = 69, j = 66], [i = 7
1, j = 30], [i = 75, j = 34], [i = 38, j = 30], [i = 78, j = 28], [i = 27, j = 3
4], [i = 12, j = 24], [i = 2, j = 9]]
Press any key to continue...
源程序是:
package xi.sisu.util;
import java.util.*;
public class Reverse {
public static void main(String[] args) {
CompType[] a = new CompType[10];
Arrays2.fill(a, CompType.generator());
System.out.println("before sorting, a = " + Arrays.asList(a));
Arrays.sort(a, Collections.reverseOrder());
System.out.println("after sorting, a = " + Arrays.asList(a));
}
}
那个reverseOrder到底起的什么作用啊?
还有,刚发现,c里面调用函数有传引用和传值一说,java里面好像没有哦? 是默认的都可以修改传进来的参数么?
[此贴子已经被作者于2006-7-22 9:22:43编辑过]