Hello
Everyone programming in Java should already be tired of using for
looping, which almost always has a syntax similar to this:
for (int x = 0; x < y; x++) {
...
}
I was analyzing some codes and came across a different syntax:
for (String novaString : arrayDeStrings) {
...
{
As I understand it, the loop will repeat X times, where X is equal to the array of strings ( arrayDeStrings.length
) and every repetition, novaString
will receive the contents of one of the strings of arrayDeStrings
.
Questions
Is this the same syntax that works? Are there any syntaxes other than those mentioned in this question? If so, how do they work?