import java.util.*;
class TreeSetDemo{
public static void main(String[]args){
//TreeSet ts = new TreeSet();
Student ts = new Student("洪杰",21);//因为Student类中的构造方法有参数
/*
ts.add("张三1",21);
ts.add("张三2",22);
ts.add("张三3",23);
Iterator it = ts.iterator();
while(it.hasNext()){
System.out.println(it.next());
}
*/
System.out.println(ts); //该打印时对象
//该打印的是对象的属性
System.out.println("姓名:"+ts.getName()+",年龄:"+ts.getAge());
}
}
class Student{
private int age;
private String name;
Student(String name,int age){
this.name = name ;
this.age = age;
}
public String getName(){
return name;
}
public int getAge(){
return age;
}
}