java 单词排序问题

2024年12月02日 15:46
有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]