The compiler can only check for syntax, i.e. missing braces, undefined method calls or variables (typing System.Out.println()), etc. The words/symbols in the
java file do not follow the established rules of what can follow what.
a run-time error happens when the code is syntactically correct, but something weird happens. For example, you ask the user to enter two values, and your code will divide 'a' by 'b'. Your code can be 100% correct, but if the user inputs 0 for the denominator, you will get an exception at runtime.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors