//以下程序为什么最后一次添加的对象不显示?
import java.util.*;
class Wd5
{
public static void main(String[] args)

TreeSet ts=new TreeSet();
ts.add(new Student(3,"xwd"));
ts.add(new Student(1,"xia"));
ts.add(new Student(2,"weng"));
ts.add(new Student(1,"zhe"));
Iterator it=ts.iterator();
while(it.hasNext())
System.out.println(it.next());

}
}class Student implements Comparable
{
int num;
String name;
Student(int num,String name)
{
this.num=num;
this.name=name;
}

public int compareTo(Object o)
{
Student s=(Student)o;
return num > s.num ? 1 : (num==s.num ? 0 : -1);
}
public String toString()
{
return num+":"+name;
}
}