This is a special type of loop to access array elements of the array. But this loop can be used only to traverse an array, and nothing can be changed in the array using this loop.
```java
importjava.io.*;
importjava.util.*;
publicclassSolutions{
publicstaticvoidmain(String[]args){
int[]arr={10,20,30,40,50};
for(inti:arr){
System.out.print(i+" ");
}
}
}
Output:
1020304050
```
## Array of Object
An array of objects is created like an array of primitive type data items in the following way.