提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
Java排序字符串数组
import java.util.Arrays; // 来 自 N o w J a v a . c o m public class Main { public static void main(String args[]){ String[] strNames = new String[]{"John", "alex", "Chris", "williams", "Mark", "Bob"}; Arrays.sort(strNames); System.out.println("String array sorted (case sensitive)"); for(int i=0; i < strNames.length; i++){ System.out.println(strNames[i]); } /* 时 代 J a v a - N o w J a v a . c o m */ Arrays.sort(strNames); System.out.println(