A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© xiaomilu 中级黑马   /  2017-4-1 21:33  /  1091 人查看  /  6 人回复  /   1 人收藏 转载请遵从CC协议 禁止商业使用本文

ArrayList<E>集合:大小可变数组的实现
       <E>:是一种特殊的数据类型,泛型。
        在出现E的地方我们使用引用数据类型替换即可
          举例:ArrayList<String>,ArrayList<Student>
构造方法
         ArrayList()
//创建集合对象
ArrayList<要存储元素的数据类型> 变量名 = new ArrayList<要存储元素的数据类型>();
        ArrayList<String> list = new  ArrayList<String>();
集合的遍历
for(int i=0; i<list.size(); i++) {
            String s = list.get(i);
            System.out.println(s);
        }

6 个回复

倒序浏览
什么意思???
回复 使用道具 举报
想要表达什么意思?表示看不懂
回复 使用道具 举报
66666666666666666666666666666666
回复 使用道具 举报
看不懂 完全不懂
回复 使用道具 举报
迭代器遍历
回复 使用道具 举报
Iterator<Product> iterator=products.iterator();
        while (iterator.hasNext()) {
                        Product product = (Product) iterator.next();
                        System.out.println(product);
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马