I don't know why each time I implements a class. when I use @Override
Eclipse always notice error:
the method A of type B must override a superclass method
(With method A is method that I override and B is the current class I work with)
And Eclipse recommend delete @Override
But with the same code, I work on Idea, no error found.
Who can tell me why,please.
thanks :)
@Edit: Oh, I don't post exactly code because It happend for all when I implement sth: for example:
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(){
}
@Override @Override annotation informs the compiler that the element is meant to override an element declared in a superclass. Overriding methods will be discussed in Interfaces and Inheritance. While it is not required to use this annotation when overriding a method, it helps to prevent errors.
The @Override annotation indicates that the child class method is over-writing its base class method. It extracts a warning from the compiler if the annotated method doesn't actually override anything. It can improve the readability of the source code.
Java 5 only properly supports this annotation on methods you override when subclassing. Starting with Java 6 you can also use this annotation on methods that implement methods from an interface.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With