---
title: "(笔记)J2EE中如何运用for-loop加强（enhanced）---New Features of J2EE"
author: "danielhjd"
date: "2011-03-23T15:36:50Z"
tags: ["Java"]
categories: ["编程语言"]
slug: "j2ee-for-loop-enhanced-new-features-of-j2ee"
draft: false
lastmod: "2011-03-23T15:57:01Z"
id: 972729
url: "https://danielhjd.iteye.com/blog/972729"
---

package j2ee; import java.util.ArrayList; import java.util.List; public class ForEnhanced { \[color=red](1)在没有用iterator的情况下，for-loop遍历：其中涉及到list.size()方法和list的get()方法\[/color] public static void iteratorAarrayByFor(){ List list = new ArrayList(); list.add("How are you, guy?"); list.add("I am okay,Thanks!"); for(int i=0;i list = new ArrayList(); list.add("How are you, guy?"); list.add("I am okay,Thanks!"); for(String str:list){ System.out.println(str); } } public static void main(String\[] args) { // iteratorAarrayByFor(); iteratorAarrayByForenhenced(); } }