Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Arrays;
- import java.util.Scanner;
- public class SortArrayOfStrings {
- public static void main(String[] args) {
- Scanner s = new Scanner(System.in);
- int count = s.nextInt();
- String[] words = new String[count];
- for (int i = 0; i < words.length; i++) {
- String name = s.nextLine();
- words[i] = name;
- }
- Arrays.sort(words);
- for (int j = 0; j < words.length; j++) {
- System.out.println(words[j]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement