码迷,mamicode.com
首页 > 编程语言 > 详细

Java 数组遍历

时间:2017-05-24 17:10:09      阅读:214      评论:0      收藏:0      [点我收藏+]

标签:nbsp   intvalue   list   class   遍历数组   tor   intval   val   code   

ArrayList<Integer> al = new ArrayList<Integer>();
//数组定义

//遍历数组:
int sum = 0;
Iterator<Integer> itr = al.iterator();
while(itr.hasNext()){
    Integer intObj = (Integer)itr.next();
    sum += intObj.intValue();
}

 

Java 数组遍历

标签:nbsp   intvalue   list   class   遍历数组   tor   intval   val   code   

原文地址:http://www.cnblogs.com/tanglimei/p/6899569.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!