java 单词排序问题

2024-12-02 15:46:59
推荐回答(1个)
回答1:

参考

import java.util.Arrays;

public class Test {
public static void main(String[] args) {
String[] array = {"aabb","aacc","abc","adbc","base","bbse","aaaaaaaaa"};
Arrays.sort(array);
System.out.print(Arrays.toString(array));
}
}

输出
[aaaaaaaaa, aabb, aacc, abc, adbc, base, bbse]