Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class sortStrings{
- static void sort(String[] words){
- int i, j;
- for(i = 1; i < 10; i++){
- String temp = words[i];
- for(j = i -1; j>=0 && temp.compareToIgnoreCase(words[j])<0; j--)
- words[j+1] = words[j];
- words[j+1] = temp;
- }
- }
- public static void main(String[] args){
- String[] words = new String[10];
- for(int i = 0; i< 10; i++) words[i] = args[i];
- sort(words);
- for(int i = 0; i<10; i++)
- System.out.println(words[i]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement