@Override interface eclipse compile error

来源:互联网 发布:外卖哪个软件便宜 编辑:程序博客网 时间:2024/06/12 00:27

@Override interface eclipse compile error

这是因为编译使用的版本是jdk5, 把注解放到实现的方法上从jdk6才可以使用.

SO的回答:

Using the @Override annotation on methods that implement those declared by an interface is only valid from Java 6 onward. It’s an error in Java 5.

Make sure that your IDE projects are setup to use a Java 6 JRE, and that the “source compatibility” is set to 1.6 or greater. Open the Window > Preferences dialog, and browse to Java > Compiler. There you can set the “Compiler compliance level” to 1.6.

Remember that Eclipse can override these global settings for a specific project, so check those too.

0 0