The method of type must override a superclass method解决方式

The method of type must override a superclass method解决方式

在jdk1.5下要使用@Override 这个annotation 必须保证 被标注方法来源于class 而不是interface。

报错原因:
jdk版本过低。
解决方法:
第一种:直接删掉override注解。
第二种:maven的pom文件中加入如下配置:

              org.apache.maven.plugins
              maven-compiler-plugin
              2.1
             
              1.6
              1.6
             

           

第三种:按eclipse的Windows->Preferences->Java->Compiler  “configure project specific

settings”, Change from java 1.5 (5.0) to 1.6 (6.0)
此时,会发现 做了上面步骤,为啥还要报错,那是因为 导入的项目,还没把jre 变为6.0,解决办法为:项目右键->build path->configure build path->java Compiler(左边那排中) ->在右边的Compiler compliance level 修改版本为 6.0。记住是jre!记住是jre!记住是jre!纠结了个把小时,好弱鸡的说。

你可能感兴趣的:(Java)