jave foreach code example
Example 1: foreach java
for (String name : names) {
System.out.println(name);
}
Example 2: java foreach
List<String> someList = new ArrayList<String>();
// add "monkey", "donkey", "skeleton key" to someList
for (String item : someList) {
System.out.println(item);
}
Example 3: foreach jas
const array1 = ['a', 'b', 'c'];
array1.forEach(element => console.log(element));