Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Jeff Higgins Newsgroups: comp.lang.java.programmer Subject: Re: Use of @Override when implementing interfaces Date: Fri, 06 Dec 2013 09:51:20 -0500 Organization: A noiseless patient Spider Lines: 25 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 6 Dec 2013 14:52:08 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="6b9e92482af47766954d85fb77d372f5"; logging-data="21393"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18q1tNNnEy/y//Kj7KdfihCHXQkFhuuTq8=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131103 Icedove/17.0.10 In-Reply-To: Cancel-Lock: sha1:SB2aAWTohU3ZsITcqx78dgLu4+M= Xref: csiph.com comp.lang.java.programmer:26745 On 12/06/2013 02:01 AM, Fredrik Jonson wrote: > 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. > Some interesting discussion around this Netbeans bug report.