JAVAÖеÄArray.sort£¨£©·½·¨
»¨Á˵ãʱ¼äÈ¥Ñо¿£¬Ò²ËãСÓÐÊÕ»ñ£º
Arrays.sort()·½·¨ÔÚJDKÀïÓкܶ࣬ÆäÖÐ×ÅÖØ˵ÏÂ
static void
sort(Object[] a)
static
<T> void
sort(T[] a, Comparator<? super T> c)
Ç°Õß²ÎÊýÖеÄÊý×éaÖеÄËùÓÐÔªËرØÐëʵÏÖcomparable½Ó¿Ú£¬¿ÉÒÔÖØÔØcomparableµÄ·½·¨compareTo£¨£©¡£
ºóÕß²ÎÊýÖеÄÊý×éaÖеÄËùÓÐÔªËرØÐëʵÏÖcomparable½Ó¿Ú£»²ÎÊýÖеÄComparatorÒýÓÃc ÊÇ¿ØÖÆÅÅÐò˳ÐòµÄ£¬¿ÉÒÔͨ¹ýʵÏÖComparatorÈ»ºóÖØÔØÆäcompare·½·¨À´¶¨Òå¡£
Èô²»ÖØÔرȽϷ½·¨£¬Ôò½á¹ûΪ×ÔÈ»ÅÅÐò¡£
Ïà¹ØÎĵµ£º
Ê×ÏÈ˵Ã÷Ò»ÏÂÕâ¸ö”¿ì”µÄº¬Òå,ÎÒÏëÒÔÇ°ÄÇЩÌÖÂÛÕâ¸ö»°ÌâµÄÈ˵±È»ÈÏΪÕâ¸ö¿ìÊÇÖ¸³ÌÐòµÄÔËÐÐËÙ¶È,ÖÁÓÚ”Èí¼þ¿ª·¢ËٶȔ¿ÖÅÂÏëҲûÏë,»òÐíÈÏΪÈí¼þ¿ª·¢ËٶȺÍÕâ¸ö»°Ì⳶²»ÉÏÒ»µã¹Øϵ.ÄÇôÕâ¸öÎÊÌâÔÚÍøÉÏËÑËÑ,ËѵÄÒ»´ó¶Ñ,ÄÇЩc/c++ÕóÓªµÄÁÐÁ˺ܶàÀý×ÓÀ´ËµÃ÷c/c++¿ì, javaÕóÓªµÄÒ²ÊÇÈç´ ......
¿´µ½Ò»µÀjavaÌ⣬¸Ð¾õºÜ²»´í,ÎÒÔÚÔÀ´µÄ°æ±¾ÉÏÔö¼ÓÁËЩ´úÂ룬һÆðÀ´¿´¿´ÏÂÃæµÄ´úÂ뽫Êä³öʲô
class Father{
int i,j;
Father(){
add(1);
}
void add(int v){
i+=v;
j+=v;
}
void print(){
System.out.println("i:="+i);
System.out.println("j:="+j);
}
}
class C ......
Õâ¸öÎÊÌâÔÚÓÚ ÔÚFrameÖÐÌí¼Ó×é¼þʱ£¬Ã¿¸ö×é¼þÏÈÉ趨ÁËλÖ㬵«ÊÇÌí¼Óµ½FrameÖкóʼÖÕ»á³öÏÖÎÊÌâ¡£
ÀýÈ磺
class MyGame extends Frame
{
MyGame()
{
Label c[] = new Label[8];
for(i = 0; i<8; i++)
{
c[i] = new Lab ......
import java.util.prefs.*;
public class Registery {
String[] keys = {"oa"};
String[] values = {"reg"};
//°ÑÏàÓ¦µÄÖµ´¢´æµ½±äÁ¿ÖÐÈ¥
public void writeValue() { ......