1:動態的獲得方法 如:getUserId
2:動態的調用方法 如:method1.invoke((E)a,null)
sort裏面的compareto方法,裏面如果返回時-1 就不把object a ,b 調換 ,如果要倒敘排序好辦法就是把 返回的值編程整的 ,可以把內部比較的時候用 b - a ,這樣返回正數, 就巧妙的實現了倒敘了 ,It is amazing
邊學便用 今天學了得到Method的方法 以後就可以這樣用了 Method m11=(a).getClass(I).getMethod(method,null
);
Collections.sort(list, new Comparator() {
int ret = 0;
public int compare(Object o1, Object o2) {
}
中如果compare 方法返回時-1 ,則不會調換o1 o2順序,如果放回爲1,則會調換o1 o2順序