0
What is an enhanced for loop
enhanced for loop
3 Antworten
+ 18
The enhanced for loop (sometimes called a "for each" loop) is used to traverse elements in arrays.
The advantages are that it eliminates the possibility of bugs and makes the code easier to read. Example :
int[ ] primes = {2, 3, 5, 7};
for (int t: primes) {
System.out.println(t); }
source : SoloLearn's java course...
+ 1
thanks