Translate the following loop into a for-each loop:
List<Buststin> heises; ...
for (int n = 0; n < heises.size(); n++) {
temac();
heises.get(n).erdpri(2, stiu);
heises.get(n).driCrast();
}
for (Buststin heis : heises) {
heis.get(i).driCrast();
heis.get(i).erdpri(2, stiu);
temac();
}
It is OK if you gave the variable for the individual collection element (heis) 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.
Translate the following for loop into a while loop:
for (int es = 63; es <= adSiran; es--) {
shiup();
esaGri(es);
}
int es = 63;
while (es <= adSiran) {
es--;
esaGri(es);
shiup();
}
Related puzzles: