myeclipse中出现The method xxx of type must override or implement a supertype

出现问题提示:The method xxx of type must override or implement a supertype? annotation:@Override的原因

查阅了一下资料,发现说在jdk1.5下要使用@Override 这个annotation 必须保证 被标注方法来源于class 而不是interface,

但我检查过,发现自己的jdk确实是1.6版本啊。

最后发现,即使自己的jdk是1.6,还需要修改myeclipse里面的编译jdk版本,从5.0改成6.0,要不就会出现上述错误

修改路径是,在myeclipse下:Windows--Preferences--Java--Compiler,在右边的Compiler compliance level 修改版本为 6.0,就可以了    {Windows->Preferences->Java->Compiler  “configure project specific

settings”, Change from java 1.5 (5.0) to 1.6 (6.0) and then “yes” rebuild project。  这个要详细些,其实 跟前面一样}

 

此时,会发现 做了上面步骤,为啥还要报错,那是因为 导入的项目,还没把jre 变为6.0,解决办法为:项目右键->build path->configure build path->java Compiler(左边那排中) ->在右边的Compiler compliance level 修改版本为 6.0

 

按照以上改了,还是有红色叉号,还是报错,怎么办,

再把文件从窗口上先叉掉,再重新打开就不会报错了。

posted @ 2016-02-28 21:28  梦尽落花  阅读(4887)  评论(0编辑  收藏  举报