+ 1
What is for each loop in java used for?
6 Réponses
+ 17
It means you're defining each element of that array as i. So you can access the elements using i instead of array [index]. foreach loop checks all elements of a collection from first to last, so you don't need the concept of index to access elements.
+ 5
used to go through each element of array/list/collections one by one(Iteration)
+ 3
To perform an action on every item of a collection
+ 2
To iterate through every element of table.
0
if a variable name assigned or declared an array why it have to change it
for e.g.:for(int i: array)
- 1
h
a
c
k
e
d.......................................................................................