import java.util.Arrays;
public class Test{
public static void mian(String[] args){
String sr[] = {"爪哇","汇编","计算机","键盘","鼠标"};
Arrays.sort(sr);
for(int i=0;i
}
}
}
楼主是这个吧?
引入:import java.util.Arrays;
方法:Arrays.sort(数组名);
可以实现对数组按字典顺序排序.....
大小写怎么考虑排序?
import java.util.Arrays;
public class Test {
public static void main(String[] args) {
String[] ary = {"test", "abc", "apple", "PEar"};
System.out.println("Before sorted, the array is: " + Arrays.toString(ary));
Arrays.sort(ary);
System.out.println("After sorted, the new array is: " + Arrays.toString(ary));
}
}