Coming from Python, I became heavily dependent on the
“for x in y” format for lists, so instead of having this format for iterating
for (int i = 0; i < quizGrades.size(); i++) {
System.out.println( quizGrades.get(i) );
}
I would simply do this:
for int in quizGrades:
print int
So I found out that in java, there is something similar that could be used to solve the problem in the excercise!
Personally, I think that
for (int temps : weeklyTemperatures ){
System.out.println(temps);}
looks much better than
for (int i = 0; i < weeklyTemperatures.size(); i++) {
System.out.println( weeklyTemperatures.get(i) );
}
But of course the code checking system does not accept the code that I came up with, because it checks if you used the .get() method and int j, which is why I’m suggesting that maybe it should accept both answers.