0

what is a for each loop in java and how can you implement it in a program

13th Sep 2018, 10:56 PM
Shadow
Shadow - avatar
2 Respostas
+ 1
A for-each loop iterates over every element of the given container. For example: If you have an array called names and you want to print every name to the console, you would do it like this: String names[] = new String[] {"John", "Mary", "Luke"); for(String name : names){ System.out.println(name); }
13th Sep 2018, 11:44 PM
Jonas