This question already has answers here:
'Must Override a Superclass Method' Errors after importing a project into Eclipse
(13个回答)
7年前关闭。
我不知道为什么每次我实现一个类。当我使用
(方法A是我重写的方法,而B是我正在使用的当前类)
和Eclipse建议删除
但是用相同的代码,我在Idea上工作,没有发现错误。
请谁能告诉我原因。
谢谢 :)
@Edit:哦,我没有发布确切的代码,因为在我实现某件事时它就发生了:
例如:
(13个回答)
7年前关闭。
我不知道为什么每次我实现一个类。当我使用
@Override
时,Eclipse总是会注意到错误:(方法A是我重写的方法,而B是我正在使用的当前类)
和Eclipse建议删除
@Override
但是用相同的代码,我在Idea上工作,没有发现错误。
请谁能告诉我原因。
谢谢 :)
@Edit:哦,我没有发布确切的代码,因为在我实现某件事时它就发生了:
例如:
public class helloworld implements Runnable {
@Override //this line no-error with Idea and error with eclipse:the method run of type helloworld must be override a super class
public void run(){
}
最佳答案
Java 5仅在子类化时覆盖的方法上正确支持此注释。从Java 6开始,您还可以在通过接口(interface)实现方法的方法上使用此批注。