Advertisement
Guest User

Untitled

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