Java – For-Each Loop
For-Each Loop: Used to iterate over arrays or collections.
Example:
int[] numbers = {1, 2, 3, 4, 5};
for (int num : numbers) {
System.out.println(num);
}
No images available.
For-Each Loop: Used to iterate over arrays or collections.
Example:
int[] numbers = {1, 2, 3, 4, 5};
for (int num : numbers) {
System.out.println(num);
}
No images available.