Stuck at iteration


#1

i stuck at the iteration, i typed

for ( j= 0; j< weeklyTemperatures(); j++){

System.out.println( weeklyTemperatures.get(j)); }

but cannot work

what is the problem ?


#2

the problem is in your first line. You can't write only
j < weeklyTemperatures();
weeklyTempreatures is the name of variable of ArrayList. When you want to know how much element you have inside ArrayList or to go through iteration you have to use size() method of ArrayList.

just put next:
j < weeklyTemperatures.size();


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.