You can do an enhanced for loop (for java 5 and higher) for iteration on array’s elements:
String[] elements = {"a", "a", "a", "a"};
for (String s: elements) {
//Do your stuff here
System.out.println(s);
}
More Related Contents:
- Does Java JIT compiler sacrifice performance to favor Collections?
- Converting ‘ArrayList to ‘String[]’ in Java
- How can I convert List to int[] in Java? [duplicate]
- How to convert int[] into List in Java?
- Convert an array of primitive longs into a List of Longs
- How to convert an Array to a Set in Java
- How can I convert int[] to Integer[] in Java?
- How can I get the size of an array, a Collection, or a String in Java?
- Lambda expression to convert array/List of String to array/List of Integers
- Java – generate Random range of specific numbers without duplication of those numbers – how to?
- Why does Collections.sort use Mergesort but Arrays.sort does not?
- How can I generate a list or array of sequential integers in Java?
- Java: how to convert HashMap to array
- Print array without brackets and commas
- The easiest way to transform collection to array?
- ArrayList: how does the size increase?
- How to create ArrayList (ArrayList) from array (int[]) in Java
- How to convert an int[] array to a List?
- Why are arrays covariant but generics are invariant?
- How can I sort a List alphabetically?
- How can I create an Array of ArrayLists?
- How to convert a 1d array to 2d array?
- Java: BufferedImage to byte array and back
- Java Arrays.asList on primitive array type produces unexpected List type [duplicate]
- What is the fastest Java collection with the basic functionality of a Queue?
- If a char array is an Object in Java, why does printing it not display its hash code?
- Combine two integer arrays [duplicate]
- How to declare array elements volatile in Java?
- Fill an array with random numbers [duplicate]
- Check Credit Card Validity using Luhn Algorithm