導入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)+" ");
}
}
}
-
彼得(男子名)
約翰
賬單