题解 | #字符串排序#
字符串排序
http://www.nowcoder.com/practice/5af18ba2eb45443aa91a11e848aa6723
字符串排序也可以用到Arrays.sort(),真是惊艳我到我了。
public class Main{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
String[] str = new String[n];
for(int i = 0; i<str.length; i++){
str[i] = scan.next();
}
Arrays.sort(str);
for(String s : str){
System.out.println(s);
}
}
}