会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
sfshine
博客园
首页
新随笔
联系
订阅
管理
List 基本知识
import java.util.*; public class ArrayListTest{ public static void main(String dd[]){ //new了一个存储list List l=new ArrayList(); //因为Collection framework只能存储对象所以new封装类 l.add(new Integer(1)); l.add(new Integer(2)); l.add(new Integer(3)); l.add(new Integer(4)); Iterator it=l.iterator(); //hasNext是取值取的是当前值.他的运算过程是判断下个是否有值如果有继续. while(it.hasNext()){ //设it.next封装类,调用Integer的intValue方法返回值为int赋给i; int i=((Integer)it.next()).intValue(); System.out.println("Element in list is : "+i); } } }
posted @
2012-04-19 20:11
sfshine
阅读(
102
) 评论(
0
)
编辑
收藏
举报
会员力量,点亮园子希望
刷新页面
返回顶部
公告