Error: ‘else’ without ‘if’

Remove the semicolon at the end of this line:

if (temp > 95 || temp < 20);

And please, please use curly brackets! Java is not like Python, where indenting the code creates a new block scope. Better to play it safe and always use curly brackets – at least until you get some more experience with the language and understand exactly when you can omit them.

Leave a Comment