Foreach语法

先看例子:

Random rand = new Random(47);
        float f[] = new float[10];
        for(int i = 0; i < 10; i++){
            f[i] = rand.nextFloat();
            
        }
        
        for(float x: f) {
            System.out.println(x);
        }

foreach语法:

for(float x: f) {
            System.out.println(x);
        }
posted @ 2013-09-15 22:04  wiessharling  阅读(220)  评论(0)    收藏  举报