【理论】
for(String s : list){
System.out.print(s+"/t");
}
for(int i = 0;i<list.size();i++){
System.out.print(list.get(i)+"/t");
}
for(Iterator item = list.iterator();item.hasNext();){
System.out.print(item.next()+"/t");
}
【实际代码】
注意:Iterator导包导入 java.util下面的
1 List<CmsProjectPhoto> cmsProjectPhotos = spa.getCmsProjectPhotos(); 2 for(CmsProjectPhoto c:cmsProjectPhotos){ 3 System.out.println(c.getPhotourl()); 4 } 5 for(int i=0;i<cmsProjectPhotos.size();i++){ 6 System.out.println(cmsProjectPhotos.get(i)); 7 } 8 for(Iterator<CmsProjectPhoto> item=cmsProjectPhotos.iterator();item.hasNext();) 9 { 10 System.out.println(item.next()); 11 }