+ 3
What is enhanced for loop????
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
+ 3
int [] integers = {1, 2, 3};
for (int integer : integers) {
System.out.println(integer);
}