第一个类
package leio001;
import java.util.Arrays;
public class test64 {
class Stuname{
public void sortNames(String[] names) {
Arrays.sort(names);
}
}
}
第二个类
package leio001;
import leio001.test64.Stuname;
public class test65 {
/**
* @param args
*/
public static void main(String[] args) {
Stuname nba = new Stuname();
String [] names1 = new String[]{"Tom", "Jack", "Merry", "Smith","Sunny"};
System.out.println("****排序前****");
for (int i = 0; i < names1.length; i++) {
if (names1[i]!= null) {
System.out.println(names1[i]+"\t");
}
}
nba.sortNames(names1);
System.out.println("****排序后****");
for (int i = 0; i < names1.length; i++) {
if (names1[i] != null) {
System.out.println(names1[i]+"\t");
}
}
}
}
kaguya
Caballarii
相关分类