Errors do not always show up exactly where they are indicated by the compiler - that is where there compiler detected the problem, not where it was caused.
In this case, there are two curly braces in a set: '{' and '}' - if you have an open brace, then the absence of the matching close brace will be detected at the end of the file, not at the location of the "spurious" open brace.
Since that isn't your complete code, I'd guess that your whole file contains more: at the very least a small set of
using
statements, and most likely a
namespace
line:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace MyNamespace{
public class BarkingDog {
public static boolean ShouldWakeup(boolean barking, int hourOfDay) {
if (barking) {
int time = 24;
} else if (hourOfDay > 8 || hourOfDay < 22) {
return true;
} else if (hourOfDay < 0 || hourOfDay > 23) {
return false;
}
return false;
}
}
} <<<--- If this one is missing, you will get the error.
So start by looking at your whole code, and try putting the cursor on the last '}' in the file. Then press CTRL+} which will move the cursor to the matching '{'. Is there anythign above that?