题解 | #字符串排序#
字符串排序
https://www.nowcoder.com/practice/5af18ba2eb45443aa91a11e848aa6723
import java.util.*; public class Main { public static void main(String[] args) { Scanner fzhinput = new Scanner(System.in); int num = fzhinput.nextInt(); int i,j; String words[] = new String[num]; fzhinput.nextLine(); for(i=0;i<num;i++){ words[i]= fzhinput.nextLine(); } Arrays.sort(words); for(i=0;i<words.length;i++){ System.out.println(words[i]); } } }