e The Enhanced ‘for’ Loop: While studying loops we had mentioned the ‘enhanced for loop’. This special loop was designed to cater for situations where one would need to manipulate each data item of an array. Declaration of this for loop includes an iteration variable (itr-var), which is a variable that will be used to store temporarily each item from a particular collection (e.g. array, vectors, lists, sets, maps): for(type itr-var : collection) statement-block The type of itr-var should be similar or compatible to the type of the data items held in the array. Traditional vs. enhanced version: Traditional: int nums[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; int sum = 0; for(int i=0; i < 10; i++) sum += nums[i]; Enhanced: int nums[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; int sum = 0; for(int x: nums) sum += x; Sample program: class ForEach { public static void main(String args[]) { int nums[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; int sum = 0; // Use for-each style for to display and sum the values. for(int x : nums) { System.out.println("Value is: " + x); sum += x; } System.out.println("Summation: " + sum); } } x will automatically increment