Stay organized with collections
Save and categorize content based on your preferences.
Override
public
abstract
@interface
Override
implements
Annotation
Indicates that a method declaration is intended to override a
method declaration in a supertype. If a method is annotated with
this annotation type compilers are required to generate an error
message unless at least one of the following conditions hold:
-
The method does override or implement a method declared in a
supertype.
-
The method has a signature that is override-equivalent to that of
any public method declared in Object.
Summary
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# Override\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \nSummary: [Inherited Methods](#inhmethods) \n\nOverride\n========\n\n\n`\npublic\n\n\nabstract\n@interface\nOverride\n`\n\n\n`\n\n\nimplements\n\n`[Annotation](/reference/java/lang/annotation/Annotation)`\n\n\n`\n\n|--------------------|\n| java.lang.Override |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nIndicates that a method declaration is intended to override a\nmethod declaration in a supertype. If a method is annotated with\nthis annotation type compilers are required to generate an error\nmessage unless at least one of the following conditions hold:\n\n- The method does override or implement a method declared in a supertype.\n- The method has a signature that is override-equivalent to that of any public method declared in [Object](/reference/java/lang/Object).\n\n\u003cbr /\u003e\n\nSummary\n-------\n\n| ### Inherited methods |\n|-----------------------|---|\n| From interface ` `[java.lang.annotation.Annotation](/reference/java/lang/annotation/Annotation)` ` |-------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract `[Class](/reference/java/lang/Class)`\u003c? extends `[Annotation](/reference/java/lang/annotation/Annotation)`\u003e` | ` `[annotationType](/reference/java/lang/annotation/Annotation#annotationType())`() ` Returns the annotation interface of this annotation. | | ` abstract boolean` | ` `[equals](/reference/java/lang/annotation/Annotation#equals(java.lang.Object))`(`[Object](/reference/java/lang/Object)` obj) ` Returns true if the specified object represents an annotation that is logically equivalent to this one. | | ` abstract int` | ` `[hashCode](/reference/java/lang/annotation/Annotation#hashCode())`() ` Returns the hash code of this annotation. | | ` abstract `[String](/reference/java/lang/String) | ` `[toString](/reference/java/lang/annotation/Annotation#toString())`() ` Returns a string representation of this annotation. | ||"]]