本帖最后由 HM周磊 于 2013-3-21 16:59 编辑
- class TreeSetDemo
- {
- public static void main(String[] args)
- {
- TreeSet ts = new TreeSet();
- ts.add(new Student("lisi02",22));
- ts.add(new Student("lisi007",20));
- ts.add(new Student("lisi09",19));
- Iterator it = ts.iterator();
- while(it.hasNext())
- {
- Student stu = (Student)it.next();
- // (Student)it--->这里是什么意思,(对象)接口?向下转型?
- // 求解!!快疯了————
- }
- }
- }
复制代码 |
|