public class Test4 { @SuppressWarnings({ "rawtypes", "unchecked" }) public static void main(String[] args) { int i=0; String[] strs={"张三","李四","王五"}; Comparator c=Collator.getInstance(Locale.CHINA); Arrays.sort(strs,c); for (String str : strs) { System.out.println((++i)+"、"+str); } } }
输出结果: