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


#1


#4

Did you close the

for () {};

         ^

brackets?


#5

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.


#6

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


#7

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?


#8

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

3 structures, thus 3 closing brackets.


#9

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


#10

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


#12

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