该方法必须覆盖超类方法 [英] The method must override a superclass method

查看:1092
本文介绍了该方法必须覆盖超类方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我更新了我的计算机到Ubuntu 11.10 64位。我导入我的项目时有问题,它给我一个错误



方法onView()必须覆盖超类方法。



我读了一些其他帖子,该错误应该是使用java 1.5,但Ubuntu 11.10附带open-6-jdk。



任何解决方案的想法?

解决方案

这听起来像您的项目的JDK合规级别设置为1.5。 (安装在机器上的Java版本只能确定你设置合规性级别的高度)。您可以通过打开项目属性(右键单击项目名称,然后选择属性)并选择Java编译器在左边。



在Java 1.6中,可以(并且应该)使用 @Override 注释在实现的接口中定义的方法。 Java 1.5不允许这样做。


Recently I updated my computer to Ubuntu 11.10 64-bits. I have a problem when importing my projects, it gives me an error

"The method onView() must override a superclass method".

I read in some other posts that the error should be the use of java 1.5, but Ubuntu 11.10 comes with open-6-jdk.

any ideas of a solution?

解决方案

It sounds like the JDK compliance level of your project is set to 1.5. (The version of Java installed on the machine only determines how high you can set the compliance level.) You can check this in Eclipse by opening the project properties (right click on the project name, then select "Properties") and selecting "Java Compiler" on the left.

In Java 1.6, the @Override annotation can (and should) be used on methods that are defined in implemented interfaces. Java 1.5 did not allow this.

这篇关于该方法必须覆盖超类方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆