For each loop in Java;
- This is a special type of loop which can be used mostly with arrays.
- It stores each and every element of array in a variable and executes the body of loop.
- It begins with for keyword like a normal for loop.
class Easy
{
public static void main(String[] args)
{
//array declaration
int ar[]={10,50,60,80,90};
for (int i = 0; i <ar.length; i++)
System.out.print(ar[i]+" ");
}
}
/*
### Output ###
10 50 60 80 90
*/
Thank you