`
lunaedge
  • 浏览: 32582 次
  • 性别: Icon_minigender_1
  • 来自: 北京
最近访客 更多访客>>
社区版块
存档分类
最新评论

Java 中 conllection-based for 循环

    博客分类:
  • Java
阅读更多
public class forfunc {    

    enum Season{spring,summer,fall,winter}
    
    public static void main(String[] args) {
    	for (Season season:Season.values()){
    		System.out.println("The season is now "+ season );
    	}
    	
    	int array[]=new int[5];
    	
    	for (int temp:array) {
    		System.out.println("The value is now: "+temp);
    	}
    }
}
  

输出结果为:

The season is now spring
The season is now summer
The season is now fall
The season is now winter

The value is now: 0
The value is now: 0
The value is now: 0
The value is now: 0
The value is now: 0

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics