// for each loop example
class ForEachTest
{
public static void main( String args[ ] )
{
int ar[ ] = { 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 };
for(int x : ar)
{
System.out.print(x + " ");
x = x * 10; // no effect on nums
}
System.out.println();for(int x : ar)
System.out.print(x + " ");}
}
Output:10 20 30 40 50 60 70 80 90 100
10 20 30 40 50 60 70 80 90 100