java how to loop array code example
Example 1: lopp array java
For(<DataType of array/List><Temp variable name> : <Array/List to be iterated>){
System.out.println();
//Any other operation can be done with this temp variable.
}
Example 2: 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);
}
}
}