Are you sure you've named the method correctly? That you're using the right CommandEvent class? That the CommandEvent is properly imported?
Java 6 added support for @Override for methods implemented for an interface as well, so that couldn't be the issue.
Campbell Ritchie wrote:Annotations came in with Java5, but @Override works differently in Java5 and Java6.
Hey can you please tell me the @ override difference in java5 and java 6
In Java 6, we can @Override a method that we're implementing that's declared in an interface. Prior to that, it was only allowed on methods we inherited from a parent class.
When we implement a method in a Interface , why would we want to use @ override .
Please clarify this .
Same reasons as when using it for a method overridden from a class: 1) So that readers of that code will know that the method is inherited from another type, and 2) So that if we make a mistake in the method's signature (or if the parent type's signature changes), we'll get a compilation error.