Chinaunix首页 | 论坛 | 博客
  • 博客访问: 542603
  • 博文数量: 855
  • 博客积分: 40000
  • 博客等级: 大将
  • 技术积分: 5005
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-16 19:08
文章分类

全部博文(855)

文章存档

2011年(1)

2008年(854)

我的朋友

分类:

2008-10-16 19:11:57

 import java.util.ArrayList;
  import java.util.Collection;
  /**//*
  * jdk.15增加的for循环
  *
*/
  
public class TestFor
  {
  
public static void main(String[] args)
  {
  
int[] arr = {1,2,3,4,5,6,7,8,9,0};
  
for(int i : arr)
  {
  System.
out.println(i);
  }
  Collection c
= new ArrayList();
  c.add(
new String("111"));
  c.add(
new String("222"));
  c.add(
new String("333"));
  c.add(
new String("444"));
  c.add(
new String("555"));
  c.add(
new String("666"));
  c.add(
new String("777"));
  c.add(
new String("888"));
  c.add(
new String("999"));
  c.add(
new String("000"));
  
for(Object o : c)
  {
  System.
out.println(o);
  }
  }
  }

--------------------next---------------------

阅读(174) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~