Java annotation: Difference between revisions

Content deleted Content added
m Importing Wikidata short description: "Syntactic metadata for Java source code" (Shortdesc helper)
Built-in annotations: Corrected grammar.
Tags: Mobile edit Mobile web edit
Line 54:
 
=== Built-in annotations ===
This example demonstrates the use of the <code>@Override</code> annotation. It instructs the compiler to check parent classes for matching methods. In this case, an error is generated because the <code>gettype()</code> method of class Cat doesn't in fact override <code>getType()</code> of class Animal like is desired, because of the [[Case sensitivity|mismatching case]]. If the <code>@Override</code> annotation waswere absent, a new method of name <code>gettype()</code> would be created in class Cat.
 
<syntaxhighlight lang="java">