JavaWorld
addict
Reged: 06/20/03
Posts: 482
|
|
An annotation-based persistence framework
|
Anonymous
Unregistered
|
|
Quote:
Consider the situation where you extend one of the Abstract Window Toolkit (AWT)/Swing Adapter classes and accidentally misspell a base-class method name. .... public class myListener implements MouseListener { @Overrides void MousePressed(MouseEvent e) { System.out.println("Mouse button clicked!"); } }
The compiler would have flagged your code sample even without the @Overrides annotation as you are implementing the MouseListener interface. You mentioned the Adapter class in the text but the sample code did not reflect what you wrote.
|
brindy
Unregistered
|
|
true, but this would be more useful if you were extending MouseAdapter instead of implementing MouseListener (which is a more sensible approach if you don't need to implement all the methods of that interface).
|