设计程序实现以下功能:编写一个能对一组字符串(如:hello,world,welcome,hi,hey)按单词表顺序进行排序的程序类WordSort.
public class WordSort {
public static void main(String[] args) {
String[] strArr = {"hello","world","welcome","hi","hey"};
for(int i = strArr.length - 1;i > 0;i--) {
for(int j = 0;j < i;j++) {
if(strArr[j].compareToIgnoreCase(strArr[j + 1]) > 0) {
String temp = strArr[j];
strArr[j] = strArr[j + 1];
strArr[j + 1] = temp;
}
}
}
for(String i : strArr) {
System.out.println(i);
}
}
}