enhanced loop java explained code example
Example 1: enhanced for loop java
class AssignmentOperator {
public static void main(String[] args) {
char[] vowels = {'a', 'e', 'i', 'o', 'u'};
// foreach loop
for (char item: vowels) {
System.out.println(item);
}
}
}
Example 2: enhanced for loop java
for(int name: array)
{
System.out.print(name + " ");
}