Can we roughly say that the compiler in java handles syntax-errors and also checks that every variable we use be initialized with a value
More or less, though the second part is redundant because accessing an un-assigned local variable is a syntax error in Java.
A better definition of compiler error is any error which can be caught at compile time. These are violations of the Java Language Specifications
, which deal strictly with the grammar and syntax of the Java language.
For example, JLS Chapter 16
deals with definite assignment. It states:
Each local variable (§14.4) and every blank final field (§4.12.4, §126.96.36.199) must have a definitely assigned value when any access of its value occurs.
Reading through the rest of the chapter you can tell what conditions must be satisfied to ensure that the variable is definitely assigned.