Chinaunix首页 | 论坛 | 博客
  • 博客访问: 264662
  • 博文数量: 757
  • 博客积分: 40040
  • 博客等级: 大将
  • 技术积分: 4935
  • 用 户 组: 普通用户
  • 注册时间: 2008-09-09 12:37
文章分类

全部博文(757)

文章存档

2011年(1)

2008年(756)

我的朋友

分类:

2008-09-09 12:40:01

 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---------------------

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