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