annotation with netbeans and eclipse

the annotation Override is necessary for the listener of the components such as Button, Tree, etcetera, what happens is that the Netbeans IDE puts me warning when not writing and I denotes ide Eclipse error when I write, which is the correct way?

thank you…

That has actually nothing to do with Netbeans and Eclipse, but with Java versions.

In Java 5, the @Override is only meant for places where you have a concrete class and you want to change the behavior of one method.
In Java 6, it was introduced that also implementations of interface methods should have the @Override annotation, noting that it is in fact an implementation for some class or interface above, and not just a new method in the subclass.

So first you have to choose if you are Java 5 compatible or if you go with Java 6 natively. Then you have to set your IDE’s settings to match this. If you go with 5, then you should remove these annotations, but if you go with 6, then you should add them.

I just wanted to point out that the @Override annotation is never actually required, but it’s a Good Thing to use it whenever you can. It’s saved me a couple times when a superclass or interface changed, and it makes the code a lot more understandable to someone who’s reading it.


http://docs.oracle.com/javase/6/docs/api/java/lang/Override.html

Cheers,
Bobby

I really love Override on interface implementations. So much easier to clean up old code and notice problems when the compiler notifies that you have changed the interface but not the implementation.