+ 3

What is enhanced for loop????

31st May 2018, 5:35 PM
Meet Soni
Meet Soni - avatar
2 ответов
+ 26
enhanced for loop is kind of foreach loop... for-each loop because the loop iterates through each element of array/collection. char[] vowels = {'a', 'e', 'i', 'o', 'u'}; // foreach loop for (char item: vowels) { System.out.println(item); } u will find more examples here 👇 https://www.programiz.com/java-programming/enhanced-for-loop
31st May 2018, 5:52 PM
🌛DT🌜
🌛DT🌜 - avatar
+ 3
int [] integers = {1, 2, 3}; for (int integer : integers) { System.out.println(integer); }
31st May 2018, 5:52 PM
Elmer Martens
Elmer Martens - avatar