Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Fredrik Jonson Newsgroups: comp.lang.java.programmer Subject: Use of @Override when implementing interfaces (was: @override annotation not working...) Date: 6 Dec 2013 07:01:38 GMT Lines: 23 Message-ID: References: X-Trace: individual.net CA9mMNEcGZFQbQeobI91HQgvw/XdKf10AqtZ3fMweYAeVIhuI= Cancel-Lock: sha1:Y8vCs7ezIKaP+6J3L+iJwV7iY2Y= User-Agent: slrn/pre1.0.0-18 (Linux) Xref: csiph.com comp.lang.java.programmer:26742 Y HA wrote: > class Task implements Runnable { > @Override > public void run() { > System.out.println("Run method overridden in Task class"); > } > } Sorry, I can't help with the problem, but the code made me curious. Is it commont practice to use @Override when implementing interface methods? Assuming that the method has not been implemented by a superclass. Obviously, the annotation is technically allowed, still it isn't really possible to override an implementation that does not exist. And it doesn't add type safety to the code, if your method signature doesn't match the method signature of the interface, the implementing class won't compile. -- Fredrik Jonson