cycle through array java code example
Example 1: loop through array java
public class HelloWorld {
public static void main(String[] args) {
// init array
String[] family = new String[] {"Member1", "Member2", "Member3", "Member4", "Member5"};
// print array
for(String name : family)
{
System.out.println(name);
}
}
}
Example 2: java loop through array
String[] elements = {"a", "a", "a", "a"};
for (String s: elements) {
//Do your stuff here
System.out.println(s);
}