Advertisement
Guest User

SortArrayOfStrings

a guest
Sep 4th, 2014
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. import java.util.Arrays;
  2. import java.util.Scanner;
  3.  
  4. public class SortArrayOfStrings {
  5. public static void main(String[] args) {
  6. Scanner s = new Scanner(System.in);
  7. int count = s.nextInt();
  8. String[] words = new String[count];
  9.  
  10. for (int i = 0; i < words.length; i++) {
  11. String name = s.nextLine();
  12. words[i] = name;
  13. }
  14. Arrays.sort(words);
  15. for (int j = 0; j < words.length; j++) {
  16. System.out.println(words[j]);
  17. }
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement