`

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

    博客分类:
  • WEB
 
阅读更多

工程导入myeclipse时,出现问题提示:The method of type must override asuperclass? 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

 

ok!!网上很多 博客 至少改了前面步骤, 后面改单独的项目的时候,确没说明,在此把这问题的解决办法整理出来,希望对新手有帮助,当然有什么不对的地方,希望大家指正

 

 

 

 

 

分享到:
评论
8 楼 renpeijia17 2016-11-01  
虽然是N年前的文章,还是解决了我刚碰到的这个有些莫名的问题,赞!
7 楼 lvyuan1234 2016-09-29  
答案非常赞,正解
6 楼 a785975139 2016-04-21  
这才是真正正正正确的答案!!!   
5 楼 xsogab 2015-10-12  
必须点赞
4 楼 interliu 2015-03-20  
太感谢你了!
3 楼 djcbpl 2013-04-08  
要是有一个截图;说明;就更好了
2 楼 royboy 2012-08-16  
1 楼 xifan1083 2012-07-18  
xiexie

相关推荐

    The method of type must override a superclass method解决方式, myeclipse, java, web

    在Java编程语言中,"The method of type must override a superclass method" 是一个常见的错误提示,它通常出现在子类试图重写父类方法时,但没有按照正确的格式进行。这个错误通常与多态性和继承概念有关,是理解...

    android @override 报错解决方案

    现象: … java: 1801: method does not override a method from its superclass @Override… 原因: Eclipse is defaulting to Java 1.5 and you have classes implementing interface methods (which in Java 1.6 ...

    Override错误已解决

    > The method oncreate(Bundle) of type HelloWorld must override or implement a supertype method 这表示 `oncreate()` 方法未正确覆盖父类中的 `onCreate()` 方法。正确的做法是: ```java public class Hello...

    method-override:覆盖HTTP动词

    $ npm install method-override API 注意在需要了解请求方法的任何模块之前使用此模块非常重要(例如,必须在csurf模块之前使用它)。 methodOverride(getter,选项) 创建一个新的中间件函数,以新值覆盖req....

    nginx对http method的控制修改方法

    例如,当客户端发送一个POST请求时,如果Nginx配置中没有明确允许该方法,则可能会返回405 Method Not Allowed的状态码。 #### 三、源码级修改步骤 ##### 1. 进入Nginx源码目录 首先,需要获取Nginx的源码包,并...

    java异常解决方案.docx

    * java.lang.Error: Unresolved compilation problem: The method contextInitialized(ServletContextEvent) of type CreateDataSourceTableListener must override a superclass method + 解决方案:检查 Servlet ...

    methodoverride:HTTP方法覆盖Koa中间件

    注意: koa-methodoverride@2.x表示koa@2.x ,将koa-methodoverride@1.x和koa@1.x koa-methodoverride@1.x使用。 用法,更多 var app = require ( 'koa' ) ( ) ; var methodOverride = require ( 'koa-method...

    method-override:method-override源码翻译

    $ npm install method-override 原料药 记住这个模块在那些需要知道请求方法的模块之前使用(例如,必须在csurf模块之前使用) methodOverride(getter,options) 创建一个新的中间件函数和设置新的属性值,使用...

    koa_method_override:koa的方法覆盖中间件

    受快速方法覆盖的启发 用法: var method_override = require("koa_method_override") app.use(method_override());... this.request.original_method // hold the original method this.method // new method

    Google C++ Style Guide(Google C++编程规范)高清PDF

    On the other hand, you must include the header file for Foo if your class subclasses Foo or has a data member of type Foo. Sometimes it makes sense to have pointer (or better, scoped_ptr) members ...

    acpi控制笔记本风扇转速

    The overhead of a semaphore per-method is eliminated. Fixed a regression where an error was no longer emitted if a control method attempts to create 2 objects of the same name. This once again ...

    图解C# new和override的区别.doc

    这是因为`B`类的`Method`方法通过`override`关键字完全覆盖了`A`类的`Method`,所以在整个继承链中,调用`Method`都会执行`B`类的版本,除非使用`base.Method()`显式调用基类的实现。 至于接口,`new`关键字与接口...

    EHLib 6.3.171〖D7~XE5〗

    - When the current cell in the grid is on the last line, the Tab key on the grid translates the input focus to the next TabStop Control of a Form (dgvhTabToNextRowEh property must be included). ...

    asp.net mvc

    If necessary, you can override this behavior by setting the new JsonRequestBehavior property of JsonResult. For more information about the potential exploit, see the blog post JSON Hijacking on Phil ...

    微软内部资料-SQL性能优化5

    Each index row in node pages contains an index key (or set of keys for a composite index) and a pointer to a page at the next level for which the first key value is the same as the key value in the ...

    Test_invoke_super_range.rar_Superclass

    描述中提到的“invoke method of superclass”进一步确认了这一点,我们要深入理解如何在子类中调用父类的方法。 首先,让我们分析给定的文件名:`source.java`和`Test_invoke_super_range.java`。通常,`.java`...

    Spring的InitializingBean和init-method

    此时,Spring提供了另一种方式——通过`init-method`属性来指定初始化方法。在bean的定义中,我们可以添加`init-method`属性,并指定一个方法名,Spring容器会在bean实例化并设置了所有属性之后,调用这个指定的方法...

    王小平版遗传算法的光盘源代码

    Genetic Programming is a method of "Adaptive Automatic Program Induction" originally created by John Koza and James Rice of Stanford University. SGPC is a C implementation of Genetic Programming: it...

    pyloris-3.2-win32

    On a Linux machine, one must simply invoke the script in a terminal, stating a site to test: motoma@rocksalt:/home/motoma$ python pyloris-3.0.py motomastyle.com On Mac OS X, one invokes PyLoris the ...

    override-decorator:ES7 的简单覆盖装饰器

    覆盖装饰器 ES7 的简单@Override装饰器。 用法 启用阶段0或es7.decorators在巴别,然后标记该意图覆盖超类与性质性质@Override 。 class A { ...// Error: b does not override a member of its superclass

Global site tag (gtag.js) - Google Analytics