// Demonstrate syntax for for-each loop
class ForEach
{
  public static void main(String[] args)
  {
     // declare and populate an array
     int nums[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
     int sum = 0;

     // new in Java 5 is this for each syntax
     // x is the current value of the current element
     for(int x : nums)
     {
       System.out.println("Value is: " + x);
       sum +=x;
      }

      System.out.println("Summation: " + sum);
    }
}
