posts - 0,  comments - 0,  trackbacks - 0
import java.util.*;
public class TestCollection{
    public static void main(String[] args){
        Collection c = new Collection();
        c.add(new Name("悟空","1"));
        c.add(new Name("八戒","2"));
        c.add(new Name("沙僧","3"));
        Iterator i= c.iterator();//核心(红色)
        i.next();
        i.remove();
        while(i.hasNext()){
            Name n = (Name)i.next();
            System.out.print(n.getFirstname()+"  ");
        }
    }
}

class Name{
    private String firstname;
    private String secondname;
    public Name(String fname,String sname){
        firstname = fname;
        secondname = sname;
    }
    public String getFirstname(){
        return firstname;
    }
    public String getSecondname(){
        return secondname;
    }

}
posted on 2010-10-28 21:36 周乾坤 阅读(77) 评论(0)  编辑  收藏 所属分类: 学习心得交流

只有注册用户登录后才能发表评论。


网站导航:
 
<2025年7月>
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789

留言簿

随笔分类

文章分类

文章档案

搜索

  •  

最新评论