當前位置:編程學習大全網 - 網站源碼 - 數組列表排序源代碼

數組列表排序源代碼

輕松點。

導入Java . util . ArrayList;

導入Java . util . collections;

公共類Main {

/**

* @param args

*命令行參數

*/

公共靜態void main(String[] args) {

String target = "約翰·比爾·彼得";

ArrayList & lt字符串& gtlist = new ArrayList & lt字符串& gt();

for(String temp:target . split(" "){

list . add(temp);

}

collections . sort(list);

for(int I = list . size();我& gt0;我- ){

system . out . println(list . get(I-1)+" ");

}

}

}

-

彼得(男子名)

約翰

賬單

  • 上一篇:韓國特產是什麽?
  • 下一篇:ubuntu系統有自帶的c++ source code嗎
  • copyright 2024編程學習大全網