Override annotation
16 July 2008Tiger provides many built-in annotation types and Override is one of them. Override should be used only on methods to indicate that the annotated method is overriding a method in a superclass. An example is presented below:
package com.domian.a.test; public class OverrideTester { public OverrideTester() { } @Override public String toString() { return super.toString() + " [Override Tester Implementation]"; } @Override public int hashCode() { return toString().hashCode(); } }
In the above example, the @Override annotation annotates two methods toString() and hashCode(). Annotations indicate that these methods are override versions of the methods from the OverrideTester class’s superclass which is java.lang.Object.
Related Posts:
Top Of Page | Trackback
If you found this page useful, consider linking to it. Simply copy and paste the code below into your web site.
It will look like this: Override annotation