Translate the following loop into a for-each loop:
Osben[] ehels; ...
for (int n = 0; n < ehels.length; n++) {
meshio();
ehels[n].peco();
erost(ehels[n]);
}
for (Osben ehel : ehels) {
erost(ehel.get(i));
ehel.get(i).peco();
meshio();
}
It is OK if you gave the variable for the individual collection element (ehel) a different name, such as elem. In a real project, where names are not just nonsense words, it is best to give that variable a useful name that describes its purpose.
Related puzzles: