【code】
import java.util.*;//: using the "foreach" syntax
public class ForEachPrimitive{ public static void main(String args[]){
Random rand = new Random(47);
float f[] = new float[10];
for(int i = 0; i < 10; i++)
f[i] = rand.nextFloat(); /*for(int j = 0; j < 10; j++)
System.out.println(f[j]);
 */
for(float x: f)
System.out.println(x);
}
}//==================
【compile Errors!】
---------- javac ----------
ForEachPrimitive.java:15: ';' expected
for(float x: f)
                           ^
ForEachPrimitive.java:17: illegal start of expression
}
        ^
2 errors输出完成 (耗时 0 秒) - 正常终止