对象数组的比较,该如何解决

对象数组的比较
import   java.util.Arrays;
class   ArrayTest1
{
public   static   void   main(String[]   args)
{
Student[]   ss   =   new   Student[]{new   Student( "henry ",28),new   Student( "ben ",26),new   Student( "William ",38)};
Arrays.sort(ss);
for(int   i   =   0;i <ss.length;i++)
{
System.out.println(ss[i]);
}
}
}
class   Student   implements   Comparable
{
String   name;
int   age;
Student(String   name,int   age)
{
this.name   =   name;
this.age   =   age;
}
public   String   toString()
{
return   "name= "+this.name+ ",age= "+this.age;
}
public   int   compareTo(Object   o)
{
Student   s   =   (Student)o;
int   result;
result   =   name.compareTo(s.name);
/*int   result;
result   =   age> s.age   ?   1   :   (age==s.age   ?   0   :   -1);
if(result==0)
{
result   =   name.compareTo(s.name);
}*/
return   result;
}
}

我想让Student数据只根据NAME排序,以上的程序达不到想要的效果。但是根据AGE排序却没问题,不知道为什么

------解决方案--------------------
你的是根据字典顺序排列的
先排大写字母,再派小写字母,你把全部名字的第一个字母改成大写就搞定了。
------解决方案--------------------
恩,主要是名字首字母的大小写问题造成的
你排序的时候忽略大小写就ok了

稍微修改一下你Student类中的compareTo函数
把result = name.compareTo(s.name);这句换成result = name.compareToIgnoreCase(s.name);