how to create a foreach loop in java code example
Example 1: java foreach
List<String> someList = new ArrayList<String>();
// add "monkey", "donkey", "skeleton key" to someList
for (String item : someList) {
System.out.println(item);
}
Example 2: how to do for each in java
for(int i : alist)
{
i+=1
}