JDK 5.0 provides a special kind of for loop for access through all the elements of it.

Syntax

For(vaiable : collection){ Statements; }

Example:

int[] a={1,2,3,4,5,6,7,8,9,0};
  for(int i : a){
    System.out.println(i);
  }