Java - browse an array and view values

for(int i = 0; i < array.length; i++)
{
System.out.println(array[i]);
}
Ou

for(String value : array)
{
System.out.println(value);
}
The second version of the for-each loop works for arrays and collections. Most loops can be done with the for-each loop as long as you don't need to know the current position in the array. If you need to know the index or position, use the first version.

You can also use the while:

int index = 0; 

while(index < array.length)
{
String value;

value = array[index];
System.out.println(value);
index++;
}