this bit of code gives me the error message: "Syntax error on token "module", interface expected. Does anyone know why?
module TeaThiever{
}
this bit of code gives me the error message: "Syntax error on token "module", interface expected. Does anyone know why?
module TeaThiever{
}
The module
statement is only valid in a module-info.java
file and it must be used with Java 9 or above.
In Eclipse set the 'Compiler compliance level' on the project 'Java Compiler' properties page to be Java 9 or above (you also need to have a suitable Java installed).
Modules were added in Java 9. You need to update your JDK. I recommend you use Java 11.
Project -> Propertes -> Java Build Path -> Libraries -> Add Lbrary -> JRE System Library -> Execution environment -> JavaSE-11(jre).