Enhanced for loop or the for each loop is a special purpose for loop used for working with arrays in java.
Syntax:
for ( type variable : array_name ) {
statement / statements ;
}
class ForEachDemo
{
public static void main(String args[])
{
for(String data : args)
{
System.out.println(data);
}
}
}