0

What is an enhanced for loop

enhanced for loop

30th May 2017, 7:52 AM
priaa
priaa - avatar
3 Réponses
+ 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...
30th May 2017, 7:55 AM
Dev
Dev - avatar
+ 1
thanks
31st May 2017, 4:10 AM
priaa
priaa - avatar