Reached end of file while parsing? Trying to run a for loop on weekly temperatures

Did you close the

for () {};



I find this rather strange. I have exactly the same piece of code running.

Select all of the code, copy it and try refreshing the page. Then paste again and rerun. Hope it works this way, cause nothing seems wrong.

Oh now I see, you missed to close the class brackets! Add one more } at the end of your code.

1 Like

Yes it seems you were right I needed an additional } bracket. I had some code that didn’t work the other day, so I copied it restarted the exercise then pasted the same code and it ran. Sooo I was a bit skeptical about this one. I do have a question though, why is it we have 3 } brackets at the end of the code?

Because you need brackets for:
• public class TemperatureC
• public static void main(String args)
• and the for loop

3 structures, thus 3 closing brackets.

Ok that makes sense. Thanks for the assistance. How long have you been writing code?

hum, every now and then. Did the Java course yesterday.

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